regex - Perl regular expression replace string with a substring of the regular expression -


I have a question about Pearl.

Assume that my file has the following line:

  Domek Long ("This Isvirative", L. ISI Meverial);  

I want to change "ThisIsMyVariable" by cp_const_ThisIsMyVariable

So my goal is:

  DoMatchLong (cp_const_ThisImMyVariable, lThisIsMyVariable); $ Count = s / (? & Lt; = ") \ w + (? =") / Const_cmd_cp _ $ and / gx;  

leads to DoMatchLong ("cp_const_ThisIsMyVariable", lThisIsMyVariable) ;

So what is the right solution?

  $ count = s / "(\ w +)" / const_cmd_cp_ $ 1 / gx ;  

Drag quotation marks into matches, then use a capturing group to get only the actual text between the quotation marks, while still changing them.


Comments