-
-
Save sjaveed/061c743b70376bb4b317ec46bcc5c000 to your computer and use it in GitHub Desktop.
regex issues
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use MONKEY-SEE-NO-EVAL; | |
my $regex-str = '"/greeting/" $<name> = (.+)'; | |
my $path = "/greeting/bob"; | |
say "Regex from String (Works)"; | |
my $regex-from-str; | |
my $expr-to-eval = "\$regex-from-str = rx\{$regex-str\}"; | |
EVAL $expr-to-eval; | |
say $path ~~ $regex-from-str; | |
say "Regex String (Doesn't Work - Why?)"; | |
say $path ~~ /<$regex-str>/; | |
say "\nActual Regex (Works)"; | |
say $path ~~ /"/greeting/" $<name> = (.+)/; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment