|
Wordle 908 4/6*
⬛⬛🟨⬛⬛
⬛🟩🟩⬛⬛
⬛🟩🟩⬛⬛
🟩🟩🟩🟩🟩
|
|
|
|
|
|
At least the non-backtracking subset. DFA regular expressions.
- they are a compact way to describe a simple syntax
- they are plain text and brief, easily communicatable and transferable
- they are cross platform (at least DFA), running in most any engine
- they are incredibly efficient (again, DFA)
- they are versatile, able to do validation, tokenization, and matching as well
That's probably why they will always be with us. They are maybe the perfect canonical execution of a Chomsky type 3 language.
Sure, they can be really terse, but this is as much a strength as it is a weakness, because it facilitates some of the above.
I know some people hate them, and I can understand that. But show me a better way.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
How the hell would someone know that "[0-9]{1,3}" is enough to find sequential numbers in Microsoft Word? How the hell did I find that magic? Every regular expression seems to require a convoluted google search. Crazy world...
|
|
|
|
|
If you give programmers super-compact notation, such as APL, they scream in horror: That is unreadable cryptic!
If you give them readable regular expressions, such as in SNOBOL, they scream in horror: That takes at least twice as many keystrokes!
The rule is simple: If we have learned the cryptics, it is excellent. Otherwise it is detestable.
Obligatory URL: Geek&Poke: Yesterday's regex[^]
|
|
|
|
|
I don't understand why it's difficult - DFA at least.
DFA is
()
[]
*
+
.
|
That's not a whole lot to master.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
Only because there are few operators it doesn't mean it is easy.
Binary is only 0 and 1, and look at what can be done with it.
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Thx, learned something new today!
the funniest thing about this particular signature is that by the time you realise it doesn't say anything it's to late to stop reading it
|
|
|
|
|
Love your sig 🤣🤣🤣
Paul Sanders.
If I had more time, I would have written a shorter letter - Blaise Pascal.
Some of my best work is in the undo buffer.
|
|
|
|
|
Except there's a spelling mistake.
|
|
|
|
|
Oh yes! Two, if you're a Yank
Paul Sanders.
If I had more time, I would have written a shorter letter - Blaise Pascal.
Some of my best work is in the undo buffer.
|
|
|
|
|
Quote: I don't understand why it's difficult - DFA at least.
I am going to answer your question as thoroughly as possible. Regexes are simple in theory, not in practice, which is why people have problems with them.
=========================================
In theory, that's all you need to know. In practice, that's just the start - you missed '^' (which has two meanings), '\' (used for escaping those special characters) and '$'.
In $PROGRAM, which of the special characters need to be escaped? How about the replacement expression in "%s" (different to the match expression "/s")? How does it match newlines (hint: in Vim, for example, '$' vs '\n' vs '\r do all different things).
Write your expression to work in vim, and it fails in your Javascript program. Write your expression in sed and it fails using the regex library in C#. The expression that works in the default invocation of grep fails in the default invocation of Perl. Use `grep -E` and the expression fails on some tools but not on others.
Even passing a regex on to an engine is difficult: in an interactive bash shell you'd use sed "s/\\t//g". In a script that sets the results of that invocation to an environment variable you'd use sed "s/\\\\t//g". You run into a similar problems within your programs when you pass around string variables containing regexes, which is why even though many of the programs which use match expressions in their configuration (like nginx) have quoting and escaping rules that differ to the command-line programs which use the same regex library.
When you use regex liberally in Python, Bash, Grep, Vim, C#, Perl, Javascript and everything else, you never remember how they all handle the special cases - you have to keep looking them up for that particular program.
I'm fairly comfortable with them, having spent the 90s as a Perl programmer, and having used Vim as my default coding editor daily for almost 30 years during which time I collected a couple of postgraduate CS (not IT) degrees (which means I know automata theory better than most), and yet even I have to look regex stuff up on a per-product basis. I am skeptical that you can look at an expression and go "This will work in $x, $y and $z, but not in $a, $b and $c.", and if my skepticism is correct, then you have problems too, but just don't know it.
And that is why people have problems with them - you never quite know which contexts allow '.' to be used to match a period and which ones use '.' to mean "any character", which character classes in a "[]" is allowed, how many levels of escaping needs to be performed, which of the special characters should be escaped and which should not.
|
|
|
|
|
yikes, i forgot how complex regex can get. gives one a headache trying to parse them, much less compose one. very worthy topic though.
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
how about natural language to regex translator? such a thing? i am checking.
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
COBOL?
As the aircraft designer said, "Simplicate and add lightness".
PartsBin an Electronics Part Organizer - Release Version 1.3.0 JaxCoder.com
Latest Article: SimpleWizardUpdate
|
|
|
|
|
close
cobol brings back a lot programming memories
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
jmaida wrote: COBOL brings back a lot of programming memories
... and a good therapist helped me deal with them.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Memories? I still use it.
Bond
Keep all things as simple as possible, but no simpler. -said someone, somewhere
|
|
|
|
|
Richard Attenborough voice in his semi-whisper:
Behold, the rare COBOL programmer in the wild, they used to roam in giant herds but are now solitary creatures. What will become of the banking ecosystem when the species becomes extinct?
I’ve given up trying to be calm. However, I am open to feeling slightly less agitated.
I’m begging you for the benefit of everyone, don’t be STUPID.
|
|
|
|
|
Richard Attenborough : Actor, Jurasic Park, The Great Escape ...
David Attenbourogh: Broadcaster and Biologist
They are brothers, though. But maybe you meant Richard?
"A little song, a little dance, a little seltzer down your pants"
Chuckles the clown
|
|
|
|
|
Yeah, I meant the one who narrates nature programs.
I’ve given up trying to be calm. However, I am open to feeling slightly less agitated.
I’m begging you for the benefit of everyone, don’t be STUPID.
|
|
|
|
|
|
need regex to natural language and vice versa
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
This alleged AI-powered generator got me close to what I needed today: https://www.regexgo.com/[^]
And this site was a great help in troubleshooting and refining the AI's results: https://regex101.com/[^]
Bonus: I still don't understand RegEx.
There are no solutions, only trade-offs. - Thomas Sowell
A day can really slip by when you're deliberately avoiding what you're supposed to do. - Calvin (Bill Watterson, Calvin & Hobbes)
|
|
|
|
|
I used ChatGPT precisely for that and it returned a decent regex with an explanation.
I needed to word my question in a manner that was generic but the result was actually helpful.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
modified 14-Dec-23 1:50am.
|
|
|
|