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 = '\'\''
''
> $s.subst( / \' ~ \' (
Hi Richard,
In a script:
my $s = '\'\'';
$s.subst( / "'" ~ "'" (.+) /, {$0}).put;
put s/ \< .+ \/ \> /$// given $s;
put s/ \' <( .+ )> \' /$// given $s;
#all three return:
HTH, Bill.
On Mon, Jan 10, 2022 at 8:46 AM Simon Proctor wrote:
>
> Within the regex the ' character is just another
Within the regex the ' character is just another string so rather than
escaping it you can write the regex as :
$s.subst( / "'" ~ "'" (.+) /, $0)
(That's " ' " (without spaces) to be exact.) And it does the trick.
You can do the same when defining it $s = "''"; or $s =
q['']; both work.
On Mon
Aha. Thanks
On 10/01/2022 15:59, Gianni Ceccarelli wrote:
On Mon, 10 Jan 2022 15:41:04 +
Richard Hainsworth wrote:
Using REPL I got
> my $s = '\'\''
''
> $s.subst( / \' ~ \' (.+) /, $0)
Use of Nil in string context
in block at line 1
That error message (which is a bit LTA) ref
On Mon, 10 Jan 2022 15:41:04 +
Richard Hainsworth wrote:
> Using REPL I got
>
> > my $s = '\'\''
> ''
> > $s.subst( / \' ~ \' (.+) /, $0)
> Use of Nil in string context
> in block at line 1
That error message (which is a bit LTA) refers to the `$0`. As
https://docs.raku.org/routi
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 = '\'\''
''
> $s.subst( / \' ~ \' (.+) /, $0)
Use of Nil in string context
in bl