l.frankline has asked for the wisdom of the Perl Monks concerning the following question:
Hi Perl Monks,
I have created a perl script relating to the regular expression.
My aim is to find other than the character range from
chr(1) to chr(126).
Please analyse the code and do the needful.
Thanks in advance.
Regards,
Franklin.
code here:
=========================================================== @char126 = (1..126); $r = 0; @mykeys = (); foreach $key (@char126) { $keyvalue = chr($key); $keyvalue = quotemeta($keyvalue); $mykeys[$r] = $keyvalue; $r++; } $mykeys = join ("|", @mykeys); $line = "This is search line some text some text Ä Å some text some te +xt"; while ($line !~s#$mykeys##) { $col = length($`); print "Line: $. Col. $col unknown entity - $&\n"; }
Edit g0n - added code tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: problem in regular expression
by davido (Cardinal) on Sep 03, 2005 at 07:30 UTC | |
by CountZero (Bishop) on Sep 03, 2005 at 07:51 UTC |