regex - Perl Regexes - Replacing certain instances of matches -


I am trying to replace the text in a source file as the preprocessor works. My approach is to stabilize and parse their values ​​and create a hash array with them. My problem is as follows:

In the source file, I have:

  define # 10 conferencing # CONSTANT_PLUS_ONE CONSTANT + 1  
< P> I define / ^ # to match the second line \ s + (\ w * *) \ s +. * ($ Key) * / , but when I define s / $ 2 / $ {$ key} / , both instances have been changed, i.e.

< I have some Pearl novice, so I'm hoping someone can point me in the right direction, Or if I made a mistake by mistake in a mistake.

Try specifying the word boundaries:

  s / \ B $ 2 \ b / $ defined {$ key} / g;  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -