Created
February 13, 2014 12:52
-
-
Save yauhen-info/8974545 to your computer and use it in GitHub Desktop.
Change boundaries of found pattern
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Input:
<Test> <LCOc1>
Output:
(Test) (LCOc1)