Anonymous user
Regular expressions: Difference between revisions
m
→[[Java]]
m (→[[Java]]: substitute) |
m (→[[Java]]) |
||
Line 21:
Pattern pat = Pattern.compile("original"); // match "original"
Matcher mat = pat.matcher(orig); // get the Matcher
String result = mat.replaceAll("modified"); // replace all matches against the pattern with "modified"
// result is now "I am the modified string"
|