Mailing List Archive

Support open source code!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: stripping HTML tags with Perl



>         s/<.*?>//ig;
> 
> This is an oops, I think.  AFAIK Perl regexps are _greedy_, matching
> the longest possible string.

The ? after the * makes it non-greedy, i.e. the shortest possible match.
This works in perl, python (re module) and php (if you use the perl
regexes, and not the older POSIX regexes).

Darren

Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links