Archived

This topic is now archived and is closed to further replies.

Regular Expression Problem (perl)

This topic is 6248 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

OK, not game programming I know, but im having some trouble with this regexp in Perl. Basically what I want it to do is to substitute every ''a'' in a variable with a ''b''. Except that it should ignore all the ''a''s inbetween < and > (html tags). Here''s what i''ve already tried, but it makes some weird results!
    

$page =~  s/(\>.*?)(a)(.*\<?)/$1b$3/gi;

    
I''ve tried loads of different combinations, but nothing seems to work correctly! Any help appreciated, I''ve been trying for the past 2 days to get this working!

Share this post


Link to post
Share on other sites