[thelist] Reg Ex - everything except a phrase

Joshua Olson joshua at waetech.com
Fri Sep 12 08:20:25 CDT 2003

----- Original Message ----- 
From: "Mark M" <mark.m at optushome.com.au>
Sent: Friday, September 12, 2003 2:52 AM

> > I tested the snippet using Python 2.3 on a Win2K box and it works
> > fine ("Hello Fred" does not match) on this combination. It would be
> > terrible if word boundary matching behaviour did vary from platform
> > to platform. I will check the regex on Python 2.2 on my Linux box at
> > and see what gives.
> Hate to pipe in at this point (considering I started this thread)
> - Pity I'm using ColdFusion MX to do my RegExs...
> Still - interesting conversation never the less.


Forward Negative lookaheads don't work.  Have you tried the first solution I

Something along the lines of:


One thing I don't think you've mentioned yet (and this is *really*
important) is where this regex will be used.  Will it be used as part of a
larger regex or will it be stand alone?

If it's stand alone you could simply use NOT Find(substring, string).

Or, if you need it to only include full words:

<cfset regex = "(^|[^a-z0-9])fred([^a-z0-9]|$)">

NOT ReFind(regex, string)

If you need to include the regex as part of a larger regex then the solution
will change drastically and you cannot use neither a simple Find nor the NOT
ReFind presented above.  I may be able to come up with something, but so far
my original idea is the only one that I've found that works in CF.


Joshua Olson
Web Application Engineer
WAE Tech Inc.

More information about the thelist mailing list