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

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


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.

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

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

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

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