This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Problem with regexp

Old posts that have not been replied to for several years.
Locked
d
darkrad
Voice
Posts: 16
Joined: Wed Sep 10, 2003 6:33 pm

Problem with regexp

Post by darkrad »

if $line var is :
<a href="/Sections/Genres/Sci-Fi/">Sci-Fi</a> / <a href="/Sections/Genres/Action/">Action</a> / <a
href="/Sections/Genres/Thriller/">Thriller</a> <a href="keywords">(more)</a>

and i try to :
[regexp -- {(?s)^.+>(.*)</a>$} $line - gen]

if i print $gen , the result is :
(more)

How do i fix this , to have $gen = Sci-Fi Action Thriller

?

thx for the support :lol:
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Re: Problem with regexp

Post by strikelight »

darkrad wrote:if $line var is :
<a href="/Sections/Genres/Sci-Fi/">Sci-Fi</a> / <a href="/Sections/Genres/Action/">Action</a> / <a
href="/Sections/Genres/Thriller/">Thriller</a> <a href="keywords">(more)</a>

and i try to :
[regexp -- {(?s)^.+>(.*)</a>$} $line - gen]

if i print $gen , the result is :
(more)

How do i fix this , to have $gen = Sci-Fi Action Thriller

?

thx for the support :lol:
You'd be better off using regsub instead of regexp..

Code: Select all

regsub -all {(<[^>]*>)} $line "" gen
Should do the trick.. Of course, "(more)" will still be in it as well, but it shouldn't be hard for you to get rid of that.
Locked