Jump to content

Regular expressions: Difference between revisions

m
m (→‎[[Java]]: substitute)
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"
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.