A question about backreference

2005-03-11 Thread Zeng Nan
Hi, Suppose there is a string var = 123, I want to substitute 123 by 456, then I have to write like this s/(var\s+=)\s+\d+/\1 123/. Is there a way so that I can combine ' ' into the parenthesis as s/(var\s+=\s+)\d+/\1456? I know \1456 is not correct, but how can I seperate \1 and 456 without

Re: A question about backreference

2005-03-11 Thread John Doe
Am Freitag, 11. März 2005 07.21 schrieb Zeng Nan: Hi, Suppose there is a string var = 123, I want to substitute 123 by 456, then I have to write like this s/(var\s+=)\s+\d+/\1 123/. Is there a way so that I can combine ' ' into the parenthesis as s/(var\s+=\s+)\d+/\1456? I know \1456 is not

Re: A question about backreference

2005-03-11 Thread Stone
Suppose there is a string var = 123, I want to substitute 123 by 456, then I have to write like this s/(var\s+=)\s+\d+/\1 123/. Is there a way so that I can combine ' ' into the parenthesis as s/(var\s+=\s+)\d+/\1456? I know \1456 is not correct, but how can I seperate \1 and 456 without

Re: A question about backreference

2005-03-11 Thread Zeng Nan
On Fri, Mar 11, 2005 at 01:10:59AM -0800, Stone wrote: Is there any chance you'll ever have var=123? Your expression currently requires the spaces. As far as I can tell, all you're doing is replacing the numbers on the right hand side of the string. So, how about using this instead: