...

View Full Version : find and replace 20 number in word.



user123
05-29-2009, 01:06 PM
hi all,
i need to replace number 20 in following word with space.
please help me to write regular exprssion for it.

only2020%20left20on20/,

i have written the ~s/20/ /g; it works but it replaced second 20 number also in this word
output of this :
only % left on /,
i want output: only 20% left on /,
please help me to write regular expresion for this.
Thanks in advance.

shyam
05-29-2009, 05:58 PM
~s/%20/ /g;?

KevinADC
05-29-2009, 06:37 PM
You can use a negated lookahead assertion:


$_ = 'only2020%20left20on20/,';
s/20(?!%)/ /g;
print;

means to replace 20 with a space if it is not proceeded by the % symbol



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum