[ale] OT Java Regular expression question
Jim Lynch
jwl at sgi.com
Thu Oct 3 13:56:34 EDT 2002
Does anyone know how to do a greedy match across newlines in java REs?
For instance:
text = "xxxabc123xyzxxx";
RE pattern = "abc(.*?)xyz";
newtext = pattern.substitute("NEW");
System.out.println(newtext);
Outputs xxxNEWxxx
But fails if text="xxxabc\n123xyzxxx";
substituteAll doesn't work either. Perl of course requires the /g
option and python has something equivalent, but I haven't figured out
what the java equivalent is.
Any ideas?
Thanks,
Jim.
---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be
sent to listmaster at ale dot org.
More information about the Ale
mailing list