Leon wrote: > > I 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? > > $a = 'this is 123 ) which I do not wish to change, and there are > many 123 so what must I do to to substitute ALL the second 123 > just before the closing bracket ... like this => ( 123 of 123 ) > and there are many 123 here too but to change the 123 here also > ( 123 of 123 ) ... and there are many 123 here too and so on and > so on !'; > > All I know is this :- > $a =~s/\s\d+\s\)/ 789 \)/g; > which is not what I want because it also substitute - > 123 )
s/(\([^)]*)123(\s*\))/${1}789$2/g; > *** I read the book and it mention about \b which I take it > as a border with a default value of a space. No. \b has zero width unlike a space which has width. > I just wonder whether I could assign the default border \b, > if this could be done, then I think I know how to have a > specific match of the above. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]