I left my email for an hour and look at all the replies. In short will
Jamie's original idea work?

>> Okay, now you've asked for it ;-). Here's one I've wondered about for
>> a long time: Is there a good way to negate a _substring_ as opposed to
>> being specific about each individual character? Lemme think of a
>> (lame) example...
>>
>> 1. see jane
>> 2. hear jane
>> 3. watch jane
>>
>> Is there a good way to match 1 and 2, besides doing something like
>> this... "[^h][^e][^a][^r] jane" or "(see|watch) jane" (say I don't
>> know about the words "see" or "watch" beforehand)
>
> I've never found a way to do this with pure regex.  Which is not to say
> that there isn't one.  However, there's a workaround I use when I need
> to do this.  It has some limitations, but it's generally useful.
>
> I take the string that I *don't* want to match and replace() it with
> something like the bell character chr(7).  I use the bell because it's
> not typable, but any character that should never ever ever be in the
> text will do.
>
> Now, I just use a negated character class:  [^#chr(7)#] to represent the
> text I don't want to match.
>
> Now, I run the replace() backwards to turn the bell into text.
>
> HTH.
>
>
>>  >Shorthand classes (as you've referred to them) have been supported
>> since
>>  >6.0 -- CF5 and earlier used POSIX style only.
>>
>> Whew, I'm fairly new to MX, so it's not like I had been missing out
>> since 4.5.
>>
>>  >Since the Java engine is built to be very Perlish, look at the Perl
>>  >regex stuff in the Mastering book for good help.
>>
>> Great, will do.
>
> Errata:  Massimo is right.  It's using the Jakarta Oro engine, not the
> Java one.  I knew there was something wrong with my answer, but I'd
> thought I got Oro wrong.  :-)
>
> While it is very Perlish (which makes sense, since it was designed to
> emulate Perl RegEx) it has some quirks (none serious) so if you've got
> Mastering 2ed, check out the notes on it toward the back.
>
> Thanks for the correction and reminder, Massimo!
>
>> Okay, that's news to me. I read this list via NNTP, and CF-Regex
>> doesn't show on my groups list, so I'll definitely look into that,
>> too.
>
> CF-Regex is definately a good resource for someone who wants to learn
> this stuff (which you seem to).  I will point out that several of the
> gurus on it (especially myself) respond badly to "do my work for me".
> However, most of us are very tolerant of even the most noob-like
> questioning, as long as you're trying to understand.  :-)  And we *all*
> enjoy tough challenges.  I can't think of any we haven't found a
> workaround or solution for.
>
> I look forward to seeing you there.
>
> --Ben Doom
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to