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


Regular Expression Problem (perl)

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