I’m getting back into Java programming and after looking at the docs it appears there is no simple way of implementing the following Ruby regexps. Can anyone help me convert the following functionality to Java, or at least point me to a good resource?
some_string = "ruby$|java$"
text.match(/#{some_string}/i)
text.gsub(/^ny\b/i, " new york ")
bevanb,
Check out the regexp lesson in the Java Tutorials. There’s a lot there, but of particular interest is the “Pattern Method Equivalents in java.lang.String” section at the bottom of the “Methods of the Pattern Class” page. A quick skim of that section suggests:
Good luck!