How exactly does on pre-compile the regex? I would be interested in seeing this.
[Jess] -----Original Message----- From: Shishir K. Singh [mailto:[EMAIL PROTECTED]] Sent: Monday, June 24, 2002 5:07 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: matching extracharacters >Hi all, >I would like to match a string variable in a longer string retreiveing >the match plus 5 extra characters at each side of the >match. >This what I mean: >$var = 'something'; >$line = 'SDFGHAsomethingWDFTsft'; >and, I would like to get in a new variable the string >'DFGHAsomethingWDFTs'. >Any help in doing this will be very appreciated. $line = 'SDFGHAsomethingWDFTsft'; $var = "something"; @x = ($line =~ /(\w{5})($var)(\w{5})/); ##or $newVar = $1.$2.$3; You may consider using eval to precompile the expression in case you have a lot's of records to regex on !! This will speed it up!! Cheers Shishir -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]