
mhx
Enthusiast
Aug 26, 2001, 1:52 AM
Post #2 of 4
(2794 views)
|
|
Re: Regular expression with .*
[In reply to]
|
Can't Post
|
|
You almost had it. Just leave the * out of the regex:
($string)=$other_string=~/(.{10}ABC.{10})/; The {10} is a quantifier, just as is the *. Keep in mind that the above regex will only match if there are at least 10 characters before and after ABC in $other_string. If you'd like it to match even with less than 10 characters, but match at most 10 characters, use this:
($string)=$other_string=~/(.{0,10}ABC.{0,10})/; Hope this helps. -- Marcus
s$$ab21b8d15c3d97bd6317286d$;$"=547269736;split'i',join$,,map{chr(($*+= ($">>=1)&1?-hex:hex)+0140)}/./g;$"=chr$";s;.;\u$&;for@_[0,2];print"@_,"
|