#regex
2 Likes
2 Shares
7 Likes
One person like that
18 Likes
9 Comments
1 Shares
Calling all #regex witches and warlocks!
I want to match individually each space at the beginning of each line of the input text. I do not want to match any other space.
Text input:
Baseline of this text
Indentation with two spaces
Surprise, the text has two spaces too!
Target syntax: PCRE2 (PHP >= 7.3)
Expected matches: 6So far my best attempt is /(?<=^| ) /m
but it also matches spaces beyond the first in any series of two or more consecutive spaces anywhere in the text, not just at the beginning of each line. See https://regex101.com/r/GXfJL0/1
Can you do better?
5 Comments
Writing An #Email #Regex Is Nearly Impossible - Invidious ⚓ https://yewtu.be/watch?v=zmyOiyQE93o ䷉ #video
One person like that
Maybe someone with #regex or #bash wildcard faible can fix this issue in #Displaylink for #Debain #Linux
https://github.com/AdnanHodzic/displaylink-debian/issues/616
2 Likes
6 Comments
Garabato Kid auf Twitter: "Regular Expressions are SO EASY!!!! https://t.co/q4GSpbJRbZ" / Twitter https://twitter.com/garabatokid/status/1147063121678389253
Regular Expressions are SO EASY!!!! pic.twitter.com/q4GSpbJRbZ
— Garabato Kid (@garabatokid) July 5, 2019
9 Likes
TIL that regular expressions go back to 1943 AI research.
https://whyisthisinteresting.substack.com/p/the-regular-expression-edition
2 Likes
While looking for a way to have a #Bash get the main #IPv4 address of an interface I came upon this solution:
ip -f inet addr show enp1s0 | grep --color=NO -Po 'inet \K[\d.]+'
This raised the question: WT(U+2131) does \K
in a (-P
erl style) #regex?
It turned out to be an alternative in #Perl for a look-ahead match:
~$ echo 'hello world' | grep -oP 'hello \K(world)'
world
~$ echo 'hello world' | grep -oP 'hello (world)'
hello world
Weiss wer weshalb ich bei #Regex in den Eckigen Klammern nicht zuerst escapen darf. Was ich möchte ist das GRÜNE, was ich erhalte ist das ROTE.
Can anybody explain me why i cant use an escaped character directly after the square bracket?
#Linux #Python
https://regex101.com/r/x7TfYk/2/
As a black programmer, I remember the cliche about problems and regular expressions in my head as "regular expressions are like calling the cops."
That's unfair to regular expressions, though, because I actually have seen them solve a problem before. Cops improving a situation? Never seen it.
https://news.ycombinator.com/item?id=7234978
pessimizer wins teh intarnets.
#cops #policebrutality #livingwhileblack #blackprogrammer #regex
2 Comments