in reply to Re: Global symbol probs...
in thread Global symbol probs...
Experimenting with regexp is fun, though hard-work (I was diagnosed dyslexic in June!)! Learning to hack, albeit slowly... Cheers, Richard#!/usr/bin/perl # imageregextest.plx # To remove an image tag: /<IMG\s+([^>]+)>/ig or /<IMG\s+(.*)>/ig # To remove anchor tag: /<[aA]\s+[hH][rR][eE][fF]=[^>]*>/ # Preamble: This program asks for a regular expression to be input, to + test for # a match to an HTML image tag. use warnings; use diagnostics; use strict; $_ = '<IMG SRC="C:\Perl\HTMLworkspace\HTML practice\My First Page!\fir +st.html\dicky.jpg" ALT="Dicky Mintos!"/> '; print "Enter a regular expression: "; my $pattern = <STDIN>; chomp($pattern); if(/$pattern/) { print "The text matches the pattern $pattern.\n"; } else { print "'$pattern' was not found\n"; }
|
|---|