Re: PCRE -> Perl 6 RE
Right, I'm going with bug. https://github.com/rakudo/rakudo/issues/2624 It looks like there's some discussion about dropping Perl5 regex support from the engine. I didn't want to translate this by hand as there's too many regexes within this source file to do so by hand (I lean on the Perl5 adverb) ... and was hoping someone get frustrated enough w/ Raku's perl5 regex implementation that rolled their own. ;( Thanks Brad, Paul On Tue, Feb 18, 2020 at 11:56 PM Brad Gilbert wrote: > The \p{L} syntax is done by using :L inside of <> instead > > /\p{L}/ > /<:L>/ > > You can combine them > > /[\p{L}\p{Z}\p{N}]/ > /<:L + :Z + :N>/ > > Character classes are also done inside of <> > > /[_.:/=+\-@]/ > /<[_.:/=+\-@]>/ > > They of course can also be combined with the previous discussed feature. > > /[\p{L}\p{Z}\p{N}_.:/=+\-@]+/ > /<:L + :Z + :N + [_.:/=+\-@] >+/ > > So that is the translation of your regex. > > --- > > It might be considered a bug that you can't just use :P5, as your regex > works just fine in Perl5. > > On Tue, Feb 18, 2020 at 10:03 PM Paul Procacci > wrote: > >> Hey Guys, >> >> I've got a bunch of source files with PCRE's like the following: >> >> [\p{L}\p{Z}\p{N}_.:/=+\-@]+ >> >> I have a program that generates other perl6 source files, by way of >> reading the initial source files. >> It was my intention to simply pass along this regex to the resulting >> output file for use in subset's like the following: >> >> subset ThisType of Str where * ~~ m:P5/[\p{L}\p{Z}\p{N}_.:/=+\-@]+/; >> >> I was going to at first hope add a PCRE adverb of sorts but that doesn't >> exist. >> I then was going to stick the Perl5 adverb on it ... but again no luck as >> it pukes on the escaped p's. >> >> Is there anything smart enough to translate these tokens into either: >> >> a) perl5 syntax for use with the Perl5 adverb or >> b) perl6 syntax for use with built-in perl6 re's. >> c) A module that anyone's familiar with that isn't publish or >> d) I'm simply SOL? >> >> Thanks, >> Paul >> >> -- >> __ >> >> :(){ :|:& };: >> > -- __ :(){ :|:& };:
Re: PCRE -> Perl 6 RE
The \p{L} syntax is done by using :L inside of <> instead /\p{L}/ /<:L>/ You can combine them /[\p{L}\p{Z}\p{N}]/ /<:L + :Z + :N>/ Character classes are also done inside of <> /[_.:/=+\-@]/ /<[_.:/=+\-@]>/ They of course can also be combined with the previous discussed feature. /[\p{L}\p{Z}\p{N}_.:/=+\-@]+/ /<:L + :Z + :N + [_.:/=+\-@] >+/ So that is the translation of your regex. --- It might be considered a bug that you can't just use :P5, as your regex works just fine in Perl5. On Tue, Feb 18, 2020 at 10:03 PM Paul Procacci wrote: > Hey Guys, > > I've got a bunch of source files with PCRE's like the following: > > [\p{L}\p{Z}\p{N}_.:/=+\-@]+ > > I have a program that generates other perl6 source files, by way of > reading the initial source files. > It was my intention to simply pass along this regex to the resulting > output file for use in subset's like the following: > > subset ThisType of Str where * ~~ m:P5/[\p{L}\p{Z}\p{N}_.:/=+\-@]+/; > > I was going to at first hope add a PCRE adverb of sorts but that doesn't > exist. > I then was going to stick the Perl5 adverb on it ... but again no luck as > it pukes on the escaped p's. > > Is there anything smart enough to translate these tokens into either: > > a) perl5 syntax for use with the Perl5 adverb or > b) perl6 syntax for use with built-in perl6 re's. > c) A module that anyone's familiar with that isn't publish or > d) I'm simply SOL? > > Thanks, > Paul > > -- > __ > > :(){ :|:& };: >
PCRE -> Perl 6 RE
Hey Guys, I've got a bunch of source files with PCRE's like the following: [\p{L}\p{Z}\p{N}_.:/=+\-@]+ I have a program that generates other perl6 source files, by way of reading the initial source files. It was my intention to simply pass along this regex to the resulting output file for use in subset's like the following: subset ThisType of Str where * ~~ m:P5/[\p{L}\p{Z}\p{N}_.:/=+\-@]+/; I was going to at first hope add a PCRE adverb of sorts but that doesn't exist. I then was going to stick the Perl5 adverb on it ... but again no luck as it pukes on the escaped p's. Is there anything smart enough to translate these tokens into either: a) perl5 syntax for use with the Perl5 adverb or b) perl6 syntax for use with built-in perl6 re's. c) A module that anyone's familiar with that isn't publish or d) I'm simply SOL? Thanks, Paul -- __ :(){ :|:& };: