I have a java file having @Start, @End tag multiple places. looking for Regex which can replace the code between these two tag (including tag)
public class MyClass{
private String name;
private String age;
@Start
private String address;
private String phoneNumber;
@End
-----------
Some more code goes here
---------------
@Start
private String pin;
private String amount;
@End
-----------
Some more code goes here
---------------
}
I’m using google replacer plugin http://code.google.com/p/maven-replacer-plugin/ and below configuration in maven pom to replace the content
<configuration>
..........
<token>@Start.*@End</token>
<value></value>
<regexFlags>
<regexFlag>DOTALL</regexFlag>
</regexFlags>
.......
</configuration>
I could replace the code between tag but it matches first @Start tag and last @End tag and removed everything between these two marker where as i want to replce the content only between two tag.
Use a non-greedy (or lazy) operator