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.
You want to replace %20, not 20.
this question has been answered and resolved on another forum.
Okay, well what is the solution?
Might help somebody else to know what the solution was.
Fair enough, as posted on codingforums:
You can use a negated lookahead assertion:
means to replace 20 with a space if it is not proceeded by the % symbolCode:$_ = 'only2020%20left20on20/,'; s/20(?!%)/ /g; print;
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks