On Jun 28, Chas Owens said:

>An important note:
>
>Be very careful when reversing the regexp /$* / is not the reverse of
>/ *$/ (/^ */ is).

So how can you reverse a regex safely?  Try YAPE::Regex::Reverse... ;)

Actually, I've not released it yet.  But it works quite well:

  jpinyan@sushi [12:42pm] ~ #614> perl rev-test
  (?-xism: *$)
  reversed: (?-imsx:^\n? *)

Upon reversing the reversed, we'd get

  (?-imsx: *\n?\z)

which is proper.  I've not released it yet because I've not added handlers
for ^ and $ under the /m modifier.

  (?m-isx: *$) [matches "abc\ndef  \nghi\n"]
  reversed: (?m-isx:^ *) [matches "\nihg\n  fed\ncba"]

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?  http://www.perlmonks.com/     http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc.     http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter.         Brother #734
**      Manning Publications, Co, is publishing my Perl Regex book      **


Reply via email to