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
import java.util.regex.* | |
Pattern p = Pattern.compile("(.*)/post/(.*)"); | |
def str = "http://home.com/post/56" | |
Matcher m = p.matcher(str); | |
if (m.find()) { | |
println m.group(1); | |
println m.group(2); | |
} |
Output
http://home.com 56
I dedicate this post to all laymen out there, who get confused with coding and stuff
No comments:
Post a Comment