While using a single, complex #regexp seems like a time-saver to some people, it also makes breaking down transformations and validations into discrete, testable steps a lot harder. In #RubyLang, many String and Array methods are faster than their regexp counterparts, too.
I generally prefer to see code that is more testable rather than a really complex regexp that attempts to validate, capture, and transform within a single expression. YMMV.
Der Filter funktioniert nicht und ist wieder gelöscht. "X" am Anfang, Schluss oder vor einem Doppelpunkt oder Bindestrich werden nicht gefunden. Zudem ist ein Buchstabe zu beliebig, um einen Filter dafür zu machen.
Technische Details: Am Anfang waren die Filter in Mastdon als reguläre Ausdrücke umgesetzt. Das war zwar nicht benutzerfreundlich, würde hier aber helfen.
@edsuom There is something in it, actually. In certain situations, a proper explanation for a #regexp would take more than regular [programming language name] code, and that's when it's time to rewrite it. Readable code is always better than comments because comments can lie.
I was being facetious, but real learning about #golang #regexp performance:
It naively walks the string from beginning to end. So while checking re("^foo").MatchString(str) is going to perform not so different from strings.HasPrefix(str, "foo"), checking re("bar$").MatchString(str) is going to be *way* slower than strings.HasSuffix(str, "bar"), especially for long strings, because it has to walk the entire string instead of just jumping to the end.
(Accurate as of Go 1.20.5)
J'ai du mal à comprendre comment ça peut marcher avec tous les nombres premiers ... mais ça a l'air d'une idée fun https://www.noulakaz.net/2007/03/18/a-regular-expression-to-check-for-prime-numbers/ #mathématiques #regexp #hack #programming
#programming #hack #regexp #mathematiques
@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
Check out the comprehensive Regular Expressions Reference on MDN Web Docs and supercharge your coding skills! 💪👩💻👨💻 - https://developer.mozilla.org/en-US/blog/regular-expressions-reference-updates/ #MDNBlogUpdate #RegExp
Original tweet : https://twitter.com/MozDevNet/status/1663368391237812226
MDN Web Docs's new reference pages on #JavaScript regular expressions are a game changer, with examples of capturing groups, named capturing groups, and more. Up your RegExp knowledge 🙌 https://developer.mozilla.org/en-US/blog/regular-expressions-reference-updates/ #RegExp
Original tweet : https://twitter.com/MozDevNet/status/1661303361545687040
Grep mit mehreren Strings
Durch die geschickte Verkettung von Suchbegriffen kann man mithilfe von grep Dateien auf mehrere Begriffe hin untersuchen.
@ology split’s first argument *is* a #regexp https://perldoc.perl.org/functions/split#split-/PATTERN/
#regexp #perl #regularexpressions #regex
A useful little site for testing the equivalence of two regular expressions:
#regularexpressions #regexp #programming #dev
Une AI qui aide à générer ses expressions régulières ?
Regex.ai - Aritifical Intelligence Regular Expression Generator
https://regex.ai/
#shaarli2mastodon #dev #regexp
An interesting tool for building regexes efficiently with magic-regexp reminded me of the rx library in emacs lisp.🙂
#typescript #javascript #regexp
In JavaScript the "empty" regular expression literal is written `/(?:)/` since the parser would erroneously take `//` as the start of a single-line comment
https://www.ecma-international.org/ecma-262/5.1/#sec-7.8.5
#JavaScript #ECMA #Empty #RegExp
#javascript #ecma #empty #regexp
Let’s make JavaScript RegExps streamy
https://socket.dev/blog/let-s-make-js-regexps-streamy
#ES_Next_News #ECMAScript #JavaScript #RegExp
#es_next_news #ecmascript #javascript #regexp