Any #RakuLang core hackers want to take up this challenge?
#RegularExpressions #RegExps #RegExes #RegEx https://ruby.social/@gd/110718818730295923
#rakulang #regularexpressions #regexps #regexes #regex
@regehr @commodore @dev There is even a (low-severity, a/k/a “cruel”) #PerlCritic policy to discourage everything but $_, @_, $], and numbered #RegularExpression capture variables: https://metacpan.org/pod/Perl::Critic::Policy::Variables::ProhibitPunctuationVars
https://metacpan.org/pod/Perl::Critic::Policy::Variables::ProhibitMatchVars already protects you against the performance-sapping $`, $&, and $' match variables
And you can configure your own prohibited list with https://metacpan.org/pod/Perl::Critic::Policy::Variables::ProhibitEvilVariables
#perlcritic #regularexpression #perl #regex #regexp #regexes #regexps
Spent half a day polishing complex #regexps in #vim . And they work too, but perl has a little different standard, so I'm basically stuck in grep -p punching a file until it works. As they say in #taoup , sometimes you just have to brute force prototype. #unix #bashcore #hobbylinguist #hobbytranslator
#regexps #vim #taoup #unix #bashcore #hobbylinguist #hobbytranslator
@Codely @drupler It helps to build your complicated #RegularExpressions in pieces and store them in separate variables. You can then test them in isolation and not be confused when you concatenate them together for your actual matching.
Both #PHP and #JavaScript also support named capture groups if you’re doing replacements. They’re a lot more readable.
Also, PHP’s #PCRE-based engine has a PCRE_EXTENDED flag that lets you add whitespace, newlines, and comments.
#regularexpressions #php #javascript #pcre #regexes #regexps
@Perl Are you working through the #OReilly #book ‘Learning #Perl’? Get extra practice with co-author brian d foy’s ‘Learning Perl Exercises’ #ebook: https://leanpub.com/learning_perl_exercises
Don’t have ‘Learning Perl’ yet? Buy it in paperback or ebook here: https://shop.aer.io/oreilly/p/learning-perl-8th/9781492094951-9149
Prefer #Amazon #Kindle? https://amzn.to/3QZj7t6 (affiliate link)
#books #bookstodon #coding #programming #SoftwareDevelopment #ProgrammingLanguages #Perl5 #RegularExpressions #regexes #regexps #Unicode #CPAN
#oreilly #book #perl #ebook #amazon #kindle #books #bookstodon #coding #programming #softwaredevelopment #programminglanguages #perl5 #regularexpressions #regexes #regexps #unicode #cpan
@sjn @cb 99% of the “#Perl is line noise” complaints are because of unformatted #RegularExpressions. Every language worth anything eventually supports them, but only @Perl (and #awk, earlier) makes them first-class citizens. And with Perl you can format and comment them for readability: https://perldoc.perl.org/perlretut#Embedding-comments-and-modifiers-in-a-regular-expression
We format the rest of our code for humans. Why not #regexps?
#PerlCritic can warn against bad regexps: https://metacpan.org/search?size=200&q=module%3APerl%3A%3ACritic%3A%3APolicy%3A%3ARegularExpressions
#perl #regularexpressions #awk #regexps #perlcritic #regex #regexes #programming #coding #softwaredevelopment
@randomatic @ChristosArgyrop@mstdn.science @HaplogroupNews @ChristosArgyrop@mastodon.social A previous employer of mine used re::engine::RE2 for many things, because a) you can cap the memory usage to avoid #DoS attacks, and b) the lead developer was all about premature optimization. https://metacpan.org/pod/re::engine::RE2
But you can’t use the /x flag for better readability, and we ran into some nasty #Unicode bugs and had to fall back to regular Perl #RegExps in those cases.
@Xiy
I use this a lot for #Ruby #regular expressions; I typically use %𝚛!...!. Also, for arrays of symbols; less commonly for arrays of strings. Oddly enough, I'll use paired delimiters (such as brackets, braces, or parentheses) for any 𝘰𝘵𝘩𝘦𝘳 list of this sort, just not #regexps. Mostly brackets, since its an array.
I found locating an authoritative list of these, by implementing Ruby version, much more of a chore than I expected.