mastouille.fr est l'un des nombreux serveurs Mastodon indépendants que vous pouvez utiliser pour participer au fédiverse.
Mastouille est une instance Mastodon durable, ouverte, et hébergée en France.

Administré par :

Statistiques du serveur :

434
comptes actifs

#regularexpression

0 message0 participant0 message aujourd’hui

My PhD student was still feeling uncomfortable with #regex, so I searched and found these awesome regex games that can help you improve your regex-fu and help you have some fun during your daily commute:

regexcrossword.com

the-regex-game.com/?level=inte

and this imho is more geared towards beginners:

regexone.com

Regex CrosswordRegex CrosswordA crossword puzzle game using regular expressions. Earn achievements completing puzzle challenges. Easy tutorials for people new to regular expressions.

At a past position, the team I was on had a #regex that was several kilobytes in length in several products. It was the stuff of nightmares! :blobfoxscared: We only managed by splitting their definition strings into multiple pieces that were assembled kind of like a puzzle. :blobfoxgooglymlem:

That said, it was also an amazing learning experience and taught me about things to be extremely careful about, like don’t go too deep with the nesting of groups, and definitely don’t sprinkle deeply nested groups with the Kleene star or anything else that is unbound in length or repetition. :blobfoxscared: :blobfoxdeadinside:

(I still love #RegularExpressions for their power, though. :blobfoxgooglytrash: )

bbs.kawa-kun.comKBBS
A répondu dans un fil de discussion

@tripleo You’re thinking of #Perl’s “taint mode” (stop your teenage giggling), where outside data is untrusted unless it’s the extracted subpattern match in a #RegularExpression.

It’s only enabled under certain conditions. Read about it in the `perlsec` manual page: perldoc.perl.org/perlsec#Taint

perldoc.perl.orgperlsec - Perl security - Perldoc Browser

I see a lot of unnecessarily specific regexs (typically excessive captures & pointless `.*$`) being used. Logic says they'll be slower so I spent about 90 seconds testing an example on 3 in-browser JS benchmark apps.
Comparing:
`/^(Hello), this is a string (.*)$/` to
`/^Hello, this is a string /`
the latter is 1.5-5x faster on all 3 apps.
#RegEx #RegExp #RegularExpression

A répondu dans un fil de discussion

@regehr @commodore @dev There is even a (low-severity, a/k/a “cruel”) #PerlCritic policy to discourage everything but $_, @_, $], and numbered #RegularExpression capture variables: metacpan.org/pod/Perl::Critic:

metacpan.org/pod/Perl::Critic: already protects you against the performance-sapping $`, $&, and $' match variables

And you can configure your own prohibited list with metacpan.org/pod/Perl::Critic:

#Perl#RegEx#RegExp

#EmacsTip: It is always better to use #Rx instead of raw #RegularExpression, because they are error-prone, especially the escapes. But if you need to use raw #RegularExpression, install #Relint, a #RegularExpression linter for #EmacsLisp. Just run relint-current-buffer in your buffer, it will find most of your #Regex bugs.

github.com/mattiase/relint

GitHubGitHub - mattiase/relint: Elisp regexp lint toolElisp regexp lint tool. Contribute to mattiase/relint development by creating an account on GitHub.