On Wed, Mar 22, 2017 at 2:50 PM, Chris Ramsey <c.w.ram...@gmail.com> wrote:
> my $str = "some string with 'text' in it and more text";
> say $str.subst(/'.*'/, "'m'", :g);
> When running this code, I get the original string back, which makes me
> think my regex isn't quite right.
> Basically I want to replace anything in single quotes with 'm' (or
> whatever other arbitrary string).

In Perl 6 regexes, single quotes actually quote things. So you're telling
it to look for the literal string ".*".

I think you want something like / "'" .* "'" / (note that spaces are not
significant in regexes normally).

brandon s allbery kf8nh                               sine nomine associates
allber...@gmail.com                                  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net

Reply via email to