[ale] Foolish Perl Question
Ken Kennedy
kkennedy at kenzoid.com
Sat Mar 23 00:01:45 EST 2002
On Fri, Mar 22, 2002 at 03:31:50PM -0500, Tommie M. Jones wrote:
>
> >
>
> This should do it
> $line[7] =~ s/\[font color.*?\]//g;
>
> . - matches any legal character.
>
> *? Means nongreedy matching
>
> Nongreedy matching is used so it will stop at the first ']' instead of the
> last.
>
>
> I think this maybe a perl only trick.
Not perl only. Several other regex implementations have non-greedy
matching. Python I know does, for example. Even .NET *hack, thrbff*, I
think...
--
Ken Kennedy | http://www.kenzoid.com | kenzoid at io.com
PGP signature
More information about the Ale
mailing list