It is a known fact that the magic of a #RegularExpression 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, #Python, 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 #Programming Guild.
/s
#regularexpression #python #programming
A place where you can test your regular expression
#regularexpression
#programming
#python
#datascience
#regularexpression #programming #python #datascience
@jernej__s @malwareminigun /\p{Quotation_Mark}solved\p{Quotation_Mark}/ #Perl #regex
(Note that doesn’t work with software using the #PCRE Perl “Compatible” #RegularExpression library because its #Unicode support is worse: https://www.pcre.org/current/doc/html/pcre2unicode.html#:~:text=Only%20the%20short%20names%20for%20properties%20are%20supported)
#perl #regex #pcre #regularexpression #unicode
@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
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 #Unicode Space Separator category.
I learned that from #regularExpression engines.
@james #macOS #Safari “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 #Firefox and #Chrome. The Content Blocker API is specifically for performant and energy-efficient sets of #RegularExpression-based URL and resource type filters.
#macos #safari #firefox #chrome #regularexpression
@Perl Here's the same one-liner with the #RegularExpression removed and using verbose "English" special variables, for those #Perl 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
#BrianKernighan - Where #GREP Came From - #Computerphile
"Commonly used grep was written overnight, but why and how did it get its name?"
https://www.youtube.com/watch?v=NTfOnGZUZDk&ab_channel=Computerphile
#BellLabs #Bell #Programming #UNIX #Linux #Pipeline #PipelineProgramming #InputOutput #ED #RegularExpression #RegularExpressions
#regularexpressions #regularexpression #ed #InputOutput #pipelineprogramming #pipeline #linux #unix #programming #bell #belllabs #computerphile #grep #BrianKernighan
@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 #RegularExpression matches I list, but it could just as easily use `isa` for class matching, or whatever.
My #regex (#RegularExpression) engine in #GoLang 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
This is *very* preliminary but I've gotten the first smoke tests done on my port of my #RegularExpression (#regex) engine to #Golang.
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
This is *very* preliminary but I've gotten the first smoke tests done on my port of my #RegularExpression (#regex) engine to #Golang.
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
As someone who has written more than what I would imagine the average number of #RegularExpression (#regex) 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.
As someone who has written more than what I would imagine the average number of #RegularExpression (#regex) 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.
Slides from the talk I gave today about #neovim #nvim #regularExpression #regex plugin `nvim-regexplainer`:
#regex #regularexpression #nvim #neovim
Slides from the talk I gave today about #neovim #nvim #regularExpression #regex plugin `nvim-regexplainer`:
#regex #regularexpression #nvim #neovim
Learn PERL
https://stackoverflow.blog/2022/07/06/why-perl-is-still-relevant-in-2022/
#perl #textprocessing #networking #automation #devops #regex #regularexpression #cpan #perlisAwesome #software #scripting #SoftwareHub #Ankara #Turkiye #Turkey
#perl #textprocessing #networking #automation #devops #regex #regularexpression #cpan #perlisawesome #software #scripting #SoftwareHub #ankara #turkiye #turkey
Earlier today I fixed a really annoying issue with my social media posting app, where in FB using Page Feed with the #GraphAPI, link previews weren't working after posting text which included a URL. I discovered that the #FB Graph API for some reason won't automatically detect URLs in the field "message". I had to use a #RegularExpression 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
#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.
#emacstip #rx #regularexpression #Relint #emacslisp #regex #emacs #regexp
Doing the FreeCodeCamp
JavaScript Algorithms and Data Structures certification and I can most definitely say that #RegularExpression is a massive pain in the butt!!! 😂😂😂
#Learning #coding #programming #refresher #javascript #regex
#regularexpression #learning #coding #programming #refresher #javascript #regex