[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ale] OT Java Regular expression question



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.