Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Change boundaries of found pattern
package info.yauhen;
public class BoundariesEditor {
public static void main(String[] args) {
//Substitute
String testString = "<Test> <LCOc1>";
testString = testString.replaceAll("\\(", "<").replaceAll("//", ">");
testString = testString
.replaceAll("<[A-Za-z0-9\\.\\-=]+>", "($0)")
.replaceAll(">\\)","\\)")
.replaceAll("\\(<","\\(");
System.out.println(testString);
}
}
@yauhen-info

This comment has been minimized.

Copy link
Owner Author

yauhen-info commented Feb 13, 2014

Input:
<Test> <LCOc1>

Output:
(Test) (LCOc1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.