101010.pl is one of the many independent Mastodon servers you can use to participate in the fediverse.
101010.pl czyli najstarszy polski serwer Mastodon. Posiadamy wpisy do 2048 znaków.

Server stats:

483
active users

#regularexpressions

0 posts0 participants0 posts today

I have written regular expression engines, in multiple languages and with various performance guarantees. I have written multiple peer-reviewed academic papers on regular expressions, and presented at multiple conferences on them. I was invited to lecture on regex transformations for multiple three-letter agencies.

Anyway yeah any time I write a regex I fuck it up.

#Python and #RegularExpressions are fun. Trying to map one set of unique identifiers against another, on a dataset that has discernable patterns but too much variability to do a simple Excel formula. Sometimes there are spaces, sometimes it's one to many. Also, the boss keeps tweaking his ask. Since it's working it a) makes it look like I know what I'm doing and b) is essentially getting to do puzzles on the clock. My opinion will, of course, change if it stops working.

New at PragProg

Staffan Nöteberg helps you really understand how the machinery works under the hood. Learn advanced tools like reluctant, lookbehind and nondeterministic finite automata to write efficient and elegant regexes with ease.

In this illustrated guide, you gain precisely that understanding., even with no prior knowledge of Regular Expressions.

pragprog.com/titles/d-snrem

@staffannoteberg

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

Regular expressions are one of the concepts that are almost universally used. Knowing, at least on a basic level, is also one of the core skills. Fanboys use regex101.com to check the matching/non-matching conditions and pros play with regexcrossword.com in the free time. But did you know that one might get into trouble if not careful when writing a regex?

If we allow untrusted user input, we could be dealing with a Denial-of-Service attack 🎯. It can happen, if we do not prevent that, for example, by setting a timeout for how long the regular expression engine should process our data.

Especially problematic are inputs that almost match the provided patterns. If our regex relies on backtracking and the input almost matches, the engine might need to spend too much time trying to match that string and never succeed. It will see that more and more characters are matching but at the very end a non-matching one would occur causing the engine to return to previous state and try to pick a different matching route.

See the example code from the linked page below 👇

Docs 📑: learn.microsoft.com/en-us/dotn

#dotnet #regex #regularexpressions
---
If you find this useful, consider giving a like & share ♻

learn.microsoft.comBest Practices for Regular Expressions in .NET - .NETLearn how to create efficient, effective regular expressions in .NET.