>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]

Reply via email to