Leon wrote: > need members help on this :- > > I wish to substitute ALL the number 123 marked in red found within the brackets ( >123 of 123 ), of $a, into 789. > > The regexes must not substitute the 4 following match :- > 123 ) > 123 > of 123 ) > 123 of 123 ) > > Therefore, the regexes MUST ONLY substitute the red 123 found in > ( 123 of 123 ) > i.e to change the above into :- > ( 123 of 789 ) > > how could this be done?
Capturing and backreferences are needed. Try s/(\( \d+ of) \d+ \)/\1 789 )/; Note a left a space out in the capturing, so I could write \1 789, while \1789 would fail. It's shorter than \{1}789 or {\1}789 (or however is the right syntax) Hope it helps you, Andrea -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]