import java.util.regex.Pattern;
public boolean RegMatch(String s, String r) {
- Pattern p = Pattern.compile(r);
return p.matcher(s).matches();
That's it!
There's a lot of simple little tweaks, hacks and tricks you look for or work out for hours and after a while, facing the same problem you remember solving it, though not in detail and you start looking for the solution again. That's what this cheat sheet is for - scraping down these little buggers.
No comments:
Post a Comment