Practice safe hex as they say…
Why waste time doing any matching if wantarray == false? Just do:
if(!wantarray) { return 1; }Before any matching happens, or if you only want one return statement set the value of a variable in if(!wantarray)/elsif(regex) and return that variable at the end.
I never understood why are people scared of regular expressions. I love them and they can be quite usefull.
Here is an example of one regex I wrote recently - it is used in replace:
(?:^-\[[^[]+\]$| ?\[.+?\] ?)that feels overcomplicated. you’re always matching on square brackets anyway, so why make it a conditional? and one case not allowing spaces seems inconsistent…
Must be irony
*sees rfc822 in a regular expression*
I bet that’s the email specification. That’s probably an email address parser.
*checks*
Perhaps worth adding that verifying an e-mail address via regex is difficult and not actually that useful.
Difficult, because a lot of e-mail addresses are syntactically valid. For example,
a@bis valid. As isa@1.2.3.4. As is"spaces are cool 😎"(with the quotes).And it’s not that useful, because you need to send out an e-mail either way, if you want to know that it’s the correct address and the user has access to it. A regex can’t catch a typo in the actual words, for example.
If you want a basic sanity check to catch when the user types their name into the e-mail field, then you can require that it contains an
and, if you want, that there’s at least one symbol before and after.
If you go beyond that, you either need a massive regex or you’re going to lock out users with unusual e-mail addresses.Yep, these email address validation tools are the bane of my existence. I use a non-typical TLD and it sometimes gets flagged as invalid because it’s not .com, .net, or .org.
I wrote one parser that checked the top level domain against a txt of all top level domains downloaded from Icann once a day. Was kind of proud of that one.
I’ve found many systems don’t work with the .company TLD!
or some u.s.-centric ones that break with .co.uk
fucking perl! Loved it…
That third one is also sad
The past tense of regex is regrets.
Must be bad at regular expressions. I generally get far more than one extra problem when using them.
No, you see, the RG was to solve the problems
What the hell kind of disgusting language is that? I need to know so I can avoid it at all costs.
The post is written in English 😔
https://en.wikipedia.org/wiki/Regular_expression
You can use it in any language.
Not sure if joking, but that looks like Perl.
I haven’t used it in like 20 years. There is a way to write it so that it’s not insane. You can write it kind of like C. But no one does that. So you end up looking at this crap.
It’s been referred to as a “write-only” language, as it’s not readable.
Everyone loves perl though! /s

Panting can also be a sign of stress with dogs






