Ever needed to have a regular expression in ColdFusion match multiple lines? I bet you thought it wasn’t possible. I sure did. Luckily, everyone’s favorite CF Junky, Jared, set me straight.
It turns, by default, in ColdFusion the ReFind and ReFindNoCase functions will not find matches which span line breaks. I killed this fly with an elephant swatter: I used java’s regex capabilities directly. What a pain.
Turns out that you can actually just prepend “(?m)” to your regular expression and viola, it works!
Turns out there’s a few of these types of things you can apply. For instance, you can use (?x) to ignore white space. Using (?i) will make the regex case insensitive, even if you’re using ReFind().
For a full list of these options see the docs at: http://livedocs.macromedia.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=ColdFusion_Documentation&file=00000980.htm