[thelist] RegExp - how to say "not this string"

Sarah Sweeney mr.sanders at designshift.com
Tue May 11 09:59:39 CDT 2004


My subject might not make much sense, but it's the best I could come up 
with to describe what I'm trying to figure out. I've been reading 
several different regular expressions tutorials, and haven't come across 
anything describing what I need. Maybe I just need a better tutorial; 
unfortunately, the Evolt one 
(http://evolt.org/article/thelist/20/22700/) didn't include the "not 
this string" concept I'm looking for. I've needed this in several 
instances, but here is my example for today...

I am trying to do a batch find/replace in Homesite, using regexps. I 
want to grab all <th> tags in the directory, so that I can add "sort by" 
links around the headings. So I need to get <th>, the heading (which 
I'll use in a back reference), and then </th>. The catch being that I 
have some headings with ColdFusion tags in them, so this regexp won't 
quite cut it:
<th>([^<]+)</th>

I know that ^x means not x - is there a way to specify "not this 
string"? Basically, what I want is something more like this:
<th>(^(</th>))</th>

And what if I wanted to say "not this string or that string"? (For 
instance if I was trying to find all input tags *not* of type submit or 
reset.)

Many thanks in advance :)

Sarah


More information about the thelist mailing list