in reply to Re: Re: Re: A regex that does this, but not that?
in thread A regex that does this, but not that?

Your character class of [^t] can itself cross word boundaries so that strings like: "this will be a problem right?" will be a problem, right?

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: A regex that does this, but not that?
by Cody Pendant (Prior) on Nov 15, 2003 at 07:32 UTC
    Quite right, very true, didn't think of that.

    What if we add a not-whitespace-either to the character class?

    #!/usr/bin/perl -w use strict; my $words='test Buffy testament Anya tot Willow tesseract Faith tent this is a problem right?'; $words =~ s/\b(t[^t\s]+t)\b/$1 eq "test" ? $1 : ''/ge; print $words;


    ($_='kkvvttuubbooppuuiiffssqqffssmmiibbddllffss') =~y~b-v~a-z~s; print