Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
447 views
in Technique[技术] by (71.8m points)

editor - How to search and replace 2 lines (together) in Eclipse?

I would like to search multiple files via eclipse for the following 2 lines:

@Length(max = L_255)
private String description;

and replace them with these two:

@Length(max = L_255, message="{validator.description.len}")
private String description;
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Another tip on how to get the regex for a selected block. Open one of the files that contains the multiple lines (multiline) to search or replace. Click Ctrl+F and select "Regular expression". Close the Find/Replace window. Select the block you need and click again Ctrl+F to open the Find/Replace window. Now in the Find text box you have the regular expression that exactly matches your selection block.

(I discovered this, only after creating manually a regexp for very long block :)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.9k users

...