Forum Moderators: coopster & phranque

Message Too Old, No Replies

reguler epression fun

         

bleak26

9:00 pm on Dec 30, 2003 (gmt 0)

10+ Year Member



Does any one know, how i would create reguler epression which will accept all the elements in the $postarray below accept small writen on its own. /small\+*\b/ this one will acept all but does not filter out small writen on its own. please could you help.

#!/usr/local/bin/perl

print "Content-type:text/html\n\n";

@postarray = qw(small+2+5+8+11 small+2+5+8+11 small large+2+5+8+11 small+2 large+2+5 small+2+5+11+8 );

foreach $element(@postarray)
{

if ( $element =~ /small\+*\b/){

#print "<br> yep it had small in it and it was ".$element;
#print "<br>";
$counter = $counter +1;
print "print counter".$element."<br>";
}
else {
#print "<br>";
#print "it did not have small in itand it was ".$element;
#print "<br>";
}
}

PCInk

9:18 pm on Dec 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Erm...
/small(\+*\b¦\s¦$)/
?

Which is:

"small", then
\+*b or space or EndOfText