Please help me understand this expression

J

Jeremy

I'm no Perl junkie, but I need to understand what this expression means.

s/\\'\''/'\'\''/g;


I know it is searching for something and replacing it with something else, but I can't seem to figure out what it means. Can someone help me?

Thanks,
Jeremy
 
D

Dr.Ruud

I need to understand what this expression means.

s/\\'\''/'\'\''/g;

Let's simplify it first:

s{\\'''}{''''}g;

So any slash that is followed by 3 quotes, will be replaced by 4 quotes.
(It was probably formatted the way it is, to silence some editor.)


But I am assuming that the substitution comes out of a Perl source file.
If the shell is involved, then other rules apply first.
Somewhere in bash, it could for example mean s{\\'}{}g.
 

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

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,134
Latest member
Lou6777736
Top