Hi Sean,

> On 15/12/12 14:00, Ralph Corderoy wrote:
> > Those last two 's are starting and ending an empty single-quoted
> > string.  ;-)  That said, it works.  These are all equivalent to it.
> >
> >      s/\'//
> >      "s/'//"
> >      's/'\''//'
> 
> when I tried the first (and most obvious) one in your list and it
> bombed! Something to do with the fact that it as already single quoted
> and the need to break out of that, I gather.

Those three all work.  You probably tried the first wrapped in single
quotes.

    's/\'//'

You're right, it won't work.  In single-quoted strings there is no
escape character, e.g. backslash, that's what's handy about them and
avoids `leaning toothpick syndrome' in things like regexps that heavily
use backslash.

So the failed attempt is a single-quoted string of three characters,
ess, slash, and backslash.  Two unquoted slashes.  And the final single
quote starts an unterminated single-quoted string.

Cheers, Ralph.

-- 
Next meeting:  Bournemouth, Tuesday, 2013-01-08 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread on mailing list:  mailto:[email protected]
How to Report Bugs Effectively:  http://goo.gl/4Xue

Reply via email to