Ed Suominen · @edsuom
1499 followers · 494 posts · Server hachyderm.io

It is a known fact that the magic of a degrades with each word of comment you explain it with. Wizardry is achieved when your regex has to be broken up into multiple lines of, say, , uses nested parentheses, line beginning or ending operators ^ and $, and gets assigned to an inscrutable variable name.

These are secrets jealously guarded by The Old Man Guild.

/s

#regularexpression #python #programming

Last updated 1 year ago

eric_ma · @eric_ma
6 followers · 30 posts · Server techhub.social
Mark Gardner ‍:sdf: · @mjgardner
691 followers · 4335 posts · Server social.sdf.org

@jernej__s @malwareminigun /\p{Quotation_Mark}solved\p{Quotation_Mark}/

(Note that doesn’t work with software using the Perl “Compatible” library because its support is worse: pcre.org/current/doc/html/pcre)

#perl #regex #pcre #regularexpression #unicode

Last updated 1 year ago

Mark Gardner ‍:sdf: · @mjgardner
661 followers · 4097 posts · Server social.sdf.org

@regehr @commodore @dev There is even a (low-severity, a/k/a “cruel”) policy to discourage everything but $_, @_, $], and numbered 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:

#perlcritic #regularexpression #perl #regex #regexp #regexes #regexps

Last updated 1 year ago

sauerkrautist · @sauerkrautist
17 followers · 13 posts · Server neurodifferent.me

Anybody who wants to dig into the semantics of portmanteau should now that I bring a very liberal attitude to the table when it comes to the Space Separator category.

I learned that from engines.

#unicode #regularexpression

Last updated 2 years ago

Mark Gardner ‍🤑 · @mjgardner
451 followers · 1782 posts · Server social.sdf.org

@james “finally” introduced extensions on the desktop in 2015 and third-party ad blockers followed shortly after. They would later revamp extensions to make it easier to port Web Extensions from and . The Content Blocker API is specifically for performant and energy-efficient sets of -based URL and resource type filters.

#macos #safari #firefox #chrome #regularexpression

Last updated 2 years ago

Mark Gardner ‍🤑 · @mjgardner
413 followers · 1531 posts · Server social.sdf.org

@Perl Here's the same one-liner with the removed and using verbose "English" special variables, for those haters who think that such things are line noise. It adds 94 characters!

% perl -MEnglish -nE '$count++ if "@" eq substr $ARG, 0, 1 and not $INPUT_LINE_NUMBER % 2; END {say "$INPUT_LINE_NUMBER lines, $count users"; say "missing ", ($INPUT_LINE_NUMBER / 2) - $count if $INPUT_LINE_NUMBER / $count != 2}' 'Perl Twitter community members.txt'
376 lines, 188 users

#regularexpression #perl

Last updated 2 years ago

Jim Donegan ✅ · @jimdonegan
1335 followers · 3268 posts · Server mastodon.scot
Mark Gardner · @mjgardner
370 followers · 1134 posts · Server social.sdf.org

@ChristosArgyrop @Perl The hash lookup in that article’s second example says it’s mainly useful for exact string matching. The `for` topicalizer pattern is still good for arbitrary conditions like the matches I list, but it could just as easily use `isa` for class matching, or whatever.

#regularexpression

Last updated 2 years ago

lorddimwit · @lorddimwit
332 followers · 1478 posts · Server mastodon.social

My () engine in was 3x faster than the stdlib regexp module when reading from an io.Reader, but slower when input was all in memory as a string, because there were optimizations the regexp module could take on strings that we weren't doing.

Now we're as fast as the regexp module in my testing for strings, and 6x faster when using an io.Reader. :)

There's still a ton of work to do, but the end is in sight.

#regex #regularexpression #golang

Last updated 2 years ago

lorddimwit · @lorddimwit
283 followers · 965 posts · Server mastodon.social

This is *very* preliminary but I've gotten the first smoke tests done on my port of my () engine to .

Here's a comparison of running a sample regex looking for a Snort signature in a large file:

; time ./sabre-test regexp
matches [177087569 177087614]
./sabre-test regexp 3.56s user 0.05s system 99% cpu 3.608 total

; time ./sabre-test sabre
matches [177087569 177087614]
./sabre-test sabre 0.99s user 0.04s system 99% cpu 1.030 total

#regularexpression #regex #golang

Last updated 2 years ago

lorddimwit · @lorddimwit
332 followers · 1478 posts · Server mastodon.social

This is *very* preliminary but I've gotten the first smoke tests done on my port of my () engine to .

Here's a comparison of running a sample regex looking for a Snort signature in a large file:

; time ./sabre-test regexp
matches [177087569 177087614]
./sabre-test regexp 3.56s user 0.05s system 99% cpu 3.608 total

; time ./sabre-test sabre
matches [177087569 177087614]
./sabre-test sabre 0.99s user 0.04s system 99% cpu 1.030 total

#regularexpression #regex #golang

Last updated 2 years ago

lorddimwit · @lorddimwit
283 followers · 961 posts · Server mastodon.social

As someone who has written more than what I would imagine the average number of () engines would be for a programmer...

...POSIX submatch semantics remove entire classes of optimizations from the available pool. Every regex engine I've written that supports POSIX submatches would easily be 10-100x faster if it didn't have to honor them.

#regularexpression #regex

Last updated 2 years ago

lorddimwit · @lorddimwit
332 followers · 1478 posts · Server mastodon.social

As someone who has written more than what I would imagine the average number of () engines would be for a programmer...

...POSIX submatch semantics remove entire classes of optimizations from the available pool. Every regex engine I've written that supports POSIX submatches would easily be 10-100x faster if it didn't have to honor them.

#regularexpression #regex

Last updated 2 years ago

Slides from the talk I gave today about plugin `nvim-regexplainer`:

bennypowers.dev/decks/nvim-reg

#regex #regularexpression #nvim #neovim

Last updated 2 years ago

Slides from the talk I gave today about plugin `nvim-regexplainer`:

github.com/bennypowers/elevent

#regex #regularexpression #nvim #neovim

Last updated 2 years ago

jprbarry · @jprbarry
54 followers · 865 posts · Server mastodon.cloud

Earlier today I fixed a really annoying issue with my social media posting app, where in FB using Page Feed with the , link previews weren't working after posting text which included a URL. I discovered that the Graph API for some reason won't automatically detect URLs in the field "message". I had to use a to extract the first URL in the string, and then create a field "link" with the value being the first URL extracted.

It's far easier to work with

#graphapi #fb #regularexpression

Last updated 2 years ago

Akib Azmain Turja · @akib
52 followers · 370 posts · Server hostux.social

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

github.com/mattiase/relint

#emacstip #rx #regularexpression #Relint #emacslisp #regex #emacs #regexp

Last updated 2 years ago

Charles De Barros · @charlesdebarros
15 followers · 34 posts · Server fosstodon.org

Doing the FreeCodeCamp
JavaScript Algorithms and Data Structures certification and I can most definitely say that is a massive pain in the butt!!! 😂😂😂

#regularexpression #learning #coding #programming #refresher #javascript #regex

Last updated 2 years ago