- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
At least they didn't use a hash symbol to separate all those branches...
Admin
This hurts my soul.
Admin
[:#.$",'#-/|]
?[B|b|C|c|G|g|H|h|J|j|K|k|L|l|M|m|S|s|U|u|Y|y]
? How does this syntax work, exactly? The regex parser implementation must be pretty interesting...Admin
I can see case-insensitivity doesn't exist here.
Admin
My reaction after seeing that regex: [image]
Admin
When it comes to "write only languages", APL (with the original greek character set) is still king!!!!
Admin
Tried putting it into Debuggex
Debuggex
Did not work. Did I do something wrong?
Filed Under: I need a graphical representation of that regex, please
Admin
Online tools ain't gonna work.
Admin
:wtf::question: Why are they using their own syntax?
Admin
I suppose it's to anonymize the WTF...
Filed Under: Or because this tweaked regex is so beautiful
Admin
Because they're professionals. They're too good for regular regex. They need… Enterprise regex.
Filed under: Regular regular expressions
Admin
At least it's not Asterisk's "Kinda-regex thing that's grossly underpowered. PCRE? Oh, we have that as well! No, you can't use it here where you really need it, what are you, crazy?"
Filed under: Bonus: every phone manufacturer has their own incompatible implementation. Documented in Engrish with half on an example provided
Admin
'Perl is jokingly referred to as a “write-only language”'
It's no joke.
Admin
Actually, there was one time when I successfully read Perl code. True story.
Filed under Myth Busted
Admin
Admin
Ok. I have to confess, that a lot of our code is written in Perl, and we do use RE's (mainly for sanitising user input in conjunction with taint mode), and yes Perl code can be written so it is maintainable for others than the original coder, but where is the fun in that... :-)
But even I would say that that piece of RE is an abomination in the extreme. It is almost as bad as the email address walidation one ( http://www.ex-parrot.com/pdw/Mail-RFC822-Address.html )
Admin
I like regular expressions. They're handy and useful, really not that hard to understand, and the hate against them is poorly-misdirected cargo cultism. But after seeing today's article, last night's partially-digested dinner is soaking into my keyboard and the submitter owes me a new one.
Admin
So, was the keyboard still able to be used after it got sat on or did they need to get a new one?
Admin
https://www.debuggex.com/r/lZb4WgK4HfkOHoWQ ?
Admin
Does the regex take more or less than 2 minutes to compile?
Admin
I dunno but it is definitely bigger than a bread box.
Admin
There were a lot of repetitions in a way that makes me think it may have been automatically generated. In any case, I've filtered out the common parts into pseudocode. All constants are encased in tildes, eg ~CONST~
Preserving newlines in the source and the order of operations with ||, we get http://pastebin.com/iMd3xUVA Ignoring newlines and reordering the || operations, we get http://pastebin.com/iMd3xUVA
... Nope, Still makes no sense.Filed under: Using quotes because the code block's preview is threatening to mangle the output with all kinds of discoshit
Admin
You might want to invest in a keyboard like this. It can be rinsed under water after such incidents:
[image]Admin
If that's not Codethulu, I don't know what is.
Admin
Most keyboards survive a trip through the dishwasher quite well, as long as you don't use detergent and give them a week to dry out again before plugging them back in.
Admin
Doctor, I feel sharp pain every morning when I put on my slippers. Any idea what it might be?
Admin
Well, either they're using a nonstandard regex parser that overloads the [ ] operator to mean both "character class match" and "non-capturing group to limit the scope of the | operator", or whoever wrote that regex doesn't really understand how character classes work.
It would be interesting to run the big ugly regex against input containing a lot of | characters to see if it matches a whole bunch of things it shouldn't. And by "interesting" I mean "something it would be amusing to hear about over morning coffee" as opposed to "something I am even vaguely motivated to do myself".
Admin
My bet is on this one. :ive_seen_some_things.dll:
Admin
Yes, regular expressions are nice, but if they take up more than a line (for various definitions of line) they become VERY write only. If you want the next guy (or yourself in 6 months) to understand it, keep it SHORT!
Obviously this wasn't a consideration for the expression in the article. The author should be kicked to the curb!
Admin
That doesn't look clicky enough.
Admin
There's nothing really wrong with that one, past being complex. It's pretty legible:
Admin
Even the trusty IBM Model M can have water seeping into the conductive layers, and I don't think those will dry unless you take them apart.
Admin
Admin
Admin
I think people are often too afraid to actually parse text into tokens, you know, take advantage of actual loops and conditionals that computers are good at, rather than limiting themselves to a mathematical model of computers (nondeterministic finite automatons) that's often too limited and hard to think about. Maybe programming languages don't make it as easy as it should.
Admin
Admin
Right.
http://tvtropes.org/pmwiki/pmwiki.php/Main/EldritchAbomination
Admin
I think you can sanitise that even more by using qr() instead of ""
Admin
@Maciejasjmj's law #1: every discussion about regexes, no matter how insane, will always have at least one person stating that it's easy, makes perfect sense, and that they have no idea what everyone else's complaining about.
Admin
Add some poor UI design (or a bug, not sure what it is) so that if you press left arrow key when the insertion point is at the end of the text box (not the end of the regex), the box contents scroll right as well as moving the insertion point — keeping the insertion point at the end, so you can’t see what’s to the right of it. Oh, and a minor bug which makes the arrow keys not move the insertion point at all if you’ve changed focus from InDesign and back while the style edit window is open.
Admin
Trying to parse the regex, but I just can't understand it at all.
https://www.youtube.com/watch?v=2aegP8j5al0
EDIT: This regex... it truly is the code of noodles.
Admin
Okay, so take a closer look at the start of this regex ...
([:-.,;/\
That's not actually a regex -- it's an emoticon of someone puking up.
Admin
I wrote a regex that parses a regex and runs it part by part because the only function that supports regexes can only handle a single backreference...
:ive_done_some_things.deleteme:
Admin
Wrong-o! APL is quite understandable once you get used to it. Just read right to left and the import of any statement is mathematically clear.
This stuff goes ...well I don't know how it goes ... I don't think this is even anchored to our universe.
Not to mention that it gives one a ... contaminated feeling...
Case in point:
See, at least APL is clean, if a little dense. This is: Unclean! Unclean!
How unclean?
See? Really, really: Unclean!
Admin
Corollary: this can be extended to any other language.
Admin
It certainly is possible to do it and it can be much more easily maintainable, because the logic can be made explicit and so can the tokens. The difficulty is that the next person along the line may not be the kind of programmer that understands natural language parsing, whereas so many think that regexes are kewl. And they will then be faced with the need to extend the model and start trying to use regexes, thus producing a complete fustercluck.
Admin
Has anyone ported PCRE to Brainfuck yet?
Admin
Are we going to have a fight about who used / knows the worst language?
No PHP, that's no fair, like Chuck Norris.
Admin
Admin
You lost me at "Ook!", could you provide a little contextualisation? Or a banana?