in reply to Re: Matching a truncated word
in thread Matching a truncated word
There is nothing really earth-shattering in the results:#!/usr/bin/perl -w $string="foobar"; if ($string =~ /(f(o(o(b(a(r)?)?)?)?)?)$/) { print "$1\n"; print "$2\n"; print "$3\n"; }
So essentially, this will do very much what I suppose John wants to do, as the most complete match goes to $1.foobar oobar obar
Very nice, Sifmole, but I bet this tends to be a pretty slow regex.
Scott
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Matching a truncated word
by Sifmole (Chaplain) on Jul 31, 2001 at 21:37 UTC |