substitution question

M

matt

I am parsing through a text file and trying the following substitution:
$_=~s/([(])"/$1\+37/g;

I am looking for times where there are (" in the text file and I need
those to be replaced with (+37

However, the substitution is replacing (" with (+3 7 <===space between
the 3 and the 7

What is wrong with this substitution?

Thanks in advance
Matt
 
P

Paul Lalli

matt said:
I am parsing through a text file and trying the following substitution:
$_=~s/([(])"/$1\+37/g;

I am looking for times where there are (" in the text file and I need
those to be replaced with (+37

However, the substitution is replacing (" with (+3 7 <===space between
the 3 and the 7

What is wrong with this substitution?

Nothing.

Please post a SHORT but COMPLETE script that demonstrates this failure.

While the code you posted should work as you described, the following
looks much cleaner to me, and should do the same thing:

s/\("/(+37/g;

Paul Lalli
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,158
Latest member
Vinay_Kumar Nevatia
Top