------art_6461_30171838.1137467977108
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Thanks for your replay.

To make the problem clear.
I want to only change the regular expression, but not the code to implement
this function.
Actually, the regular expression comes from a configurable table. I'll be
supposed to only have the privilege to update the table.

So What I really want is a alternative way to in place of the regular
expression
 (?<!STR )SNPB


2006/1/17, James Edward Gray II <james / grayproductions.net>:
>
> On Jan 16, 2006, at 8:35 PM, Eric Luo wrote:
>
> > I need to hack out an regular expression, which will match "SNPB"
> > without
> > matching "STR SNPB".
> > Since ruby 1.8.2 or 1.8.4 don't support the  lookbehind feature.
> > what's the
> > workable regular expression
> > for ruby version 1.8.2?
>
> Lookbehind is just lookahead, backwards.  ;)
>
> >> tests = %w{SNPB STR\ SNPB}
> => ["SNPB", "STR SNPB"]
> >> tests.map { |t| t.reverse }.grep(/\bBPNS\b(?! RTS)/).map { |t|
> t.reverse }
> => ["SNPB"]
>
> Hope that helps.
>
> James Edward Gray II
>
>

------art_6461_30171838.1137467977108--