Hey ChatGPT, here's an example string, how would you get this string out of it with <insert regex implementation>?
this post was submitted on 21 Mar 2024
4 points (75.0% liked)
Programmer Humor
32068 readers
443 users here now
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
- Posts must be relevant to programming, programmers, or computer science.
- No NSFW content.
- Jokes must be in good taste. No hate speech, bigotry, etc.
founded 5 years ago
MODERATORS
while :; do curl -X POST -d '{"text": "Removed by mod" }' https://lemmy.ml/post/13463433; done
Nothing to see here folks
I don't know all of the regex rules (look ahead/behind, etc); but it's honestly not that bad. If you can learn the syntax for a programming language, you can learn the basics of regex..
Sure, learning basics of regex is not that hard, but complex regex expressions can easily become impenetrable. I actually like the verbal expressions idea where you write out the regex using a long form and that gets compiled into the actual regex, e.g:
const tester = VerEx()
.startOfLine()
.then('http')
.maybe('s')
.then('://')
.maybe('www.')
.anythingBut(' ')
.endOfLine();
That seems like the best of both world approach to me.