On 1/10/22 07:41, Richard Hainsworth wrote:
If a string is enclosed in ' characters, and I want to remove the bracketing ', how do I do it?

Seems like ' is not a normal character, or is it because its not a bracketing character?

Using REPL I got

 > my $s = '\'<favicon />\''
'<favicon />'
 > $s.subst( / \' ~ \' (.+) /, $0)
Use of Nil in string context
   in block <unit> at <unknown file> line 1

 > my $t = '{<favicon />}'
{<favicon />}
 > $t.subst( / \{ ~ \} (.+) /, $0)
<favicon />


For clarity

raku -v

Welcome to Rakudo™ v2021.12.
Implementing the Raku® Programming Language v6.d.
Built on MoarVM version 2021.12.



Hi Richard,

Are you trying to remove "all" single quotes
or just the ones surrounding the spoken word:

    The profession said "The prime minister
    rejected the phrase 'Bob's your Uncle'".

Which or all of the single quotes?

-T

Bob is definitely NOT my uncle.


Reply via email to