Are there any idioms or common scenarios when you first reverse the string before matching?
$ perl -wle 'reverse("abcd") =~ /(cb)/; print $1' cb
I remember a friend doing this in a Tcl because it didn't have non-greedy quantifiers. (I wish I could remember the details... It was a very long time ago)

Replies are listed 'Best First'.
Re: Regexp a reverse-d string?
by jmcnamara (Monsignor) on Apr 14, 2003 at 08:29 UTC

    Japhy calls this a sexeger.

    Anyone who hasn't seen this technique should read the above node. It has many useful and interesting applications.

    See also Reversing Regular Expressions by Pete Sergeant on perl.com.

    --
    John.

(jeffa) Re: Regexp a reverse-d string?
by jeffa (Bishop) on Apr 14, 2003 at 16:34 UTC
    The Perl Cookbook uses this technique for recipe 2.17, Putting Commas in Numbers:
    sub commify { my $text = reverse $_[0]; $text =~ s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g; return scalar reverse $text; }

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)