3 ms·
Thanks for your kind words. You still don't see the point though. I am not simplifying regexes one single bit. The regex syntax is quite simply broken. It is f
by savolai 10y ago
Thanks for your kind words.
You still don't see the point though. I am not simplifying regexes one single bit. The regex syntax is quite simply broken. It is fragmented as hell, and its escaping and context rules stem from a time when all we had was ASCII. This might have been acceptable in the eighties, yes?
These have nothing to do with whether or not underlying regex theory is mathematically deep or not. I am not touching the theory. It's simply the syntax that is broken. You can go exactly as deep with Regex UCR as you can with traditional regexes. It's the same regex. You just don't have to torture yourself while doing it.
We need to move forward from the single-eyed view that everything must be done in text, even if it means wasting countless hours in man hours and loads of cognitive processing. We need that energy for fruitful work. You are currently just advocating bureaucracy.
Your looping example is yet another example of a theoretist making enormous assumptions the context of usage. How do you write a loop in the search/replace field of a text editor or an IDE? How does proneness to bugs matter one single bit if you're just using the tool to avoid a bit of manual work? Which [warning, hypothesis:] seems to be mostly what regexes are actually used anyway.
- brudgers 10y agoAfter writing my comment, I went for a walk and ate some Chipolte and thought a bit more. And thought about JWZ's: Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. And now I'd put it like this. It doesn't matter what changes are made to the syntax. It doesn't matter what tools we build. The problem with regex's is that they won't balance parenthesis and not balancing parenthesis is counterintuitive to the ideas of matching and patterns. Even worse, there is no way to understand why problems like balancing parenthesis are impossible without a mental model based on regex's mathematical underpinnings. I should probably admit my bias, if I'm in an IDE or a text editor (or even a browser window), the last thing I want to do is reach for a mouse.
- Tiksi 10y ago>and its escaping and context rules stem from a time when all we had was ASCII. My keyboard still only has ~ASCII on it, so having to input anything else is a huge barrier to entry. Regex syntax sucks, I'll be the first to agree with that, but it's more of an annoyance. If I write some regex to match ips(obviously not properly, but quick rough match): ([0-9]\.){1,3}[0-9]{1,3} My thought process isn't "open paren, open bracket, zero" etc, it's more of "Ok, I have a 4 groups of 1 to 3 numbers separated by dots, which can be written as 3 groups followed by a dot followed by a fourth group" and my hands translate it the rest of the way into text. Knowing exactly which character to use may have been a hindrance the first few times I ran into regex, but the real difficulty is in knowing what to match and how to match it. Providing that info to your computer once you know it is the easy part, even if the interface is horrible. It's like driving a car or a bike. You don't think "Ok, time to move my hand to move the steering wheel to the right and that will turn the wheels which will then the car to the right", you just need to turn right and your subconscious takes care of the rest. Improving the syntax would be like trying to improve how well/safely you drive by changing the steering wheel. Sure, it might help a little bit, but that's not really the difficult part of driving well, just an interface to it.
- raiph 10y agoFwiw, adapted from "Parsing an ipv4 address"[1]: / ( (\d ** 1..3) <?{ 0 < $0 < 255 }> ) ** 4 % '.' /; [1]: https://perl6advent.wordpress.com/2012/12/22/day-22-parsing-an-ipv4-address/ https://perl6advent.wordpress.com/2012/12/22/day-22-parsing-...
- savolai 10y agoOk. Please actually read my posts, make an honest attempt to understand what I am actually saying, and come back. If this comment of yours still seems relevant to in any sense of the word, please do tell me, and I will try to rephrase or answer any questions you may have. Would that be ok? Thanks.
- Tiksi 10y agoOk. I did read your posts, especially the one I replied to, and it does in fact seem relevant. However with that level of snark, I'm just gonna drop out of the conversation here as it's unlikely to be productive. Thanks.
- savolai 10y agoSorry. Perceived snark was completely unintended. What I have thought to have repeated here starting from the actual blog post, is that it is completely natural for you to perceive that the escaping is just a nuisance. You are an expert user who has already overcome the initial pain, so you can't feel it. That initial pain is exactly what I am trying to help users overcome. The pain wasn't a prohibitive barrier for you, but you can't really deduce anything from this fact. This is why your perception about your own experience of using regexes is not very useful to this discussion about whether Regex UCR is useful to its main target group. The title of the post was You Are Not Your Users, remember? You are an expert on the tool - that does not mean you are an expert on every use of the tool, of all of the people on this planet, who would use the tool, if only it wasn't broken for them. It also doesn't mean that only difficulty of the usecases you find relevant, like matching parentheses, are the only valid criteria for these users to evaluate whether regexes are useful for them. You bias, as you mention, seems to make it difficult to perceive this. There's nothing wrong with that, of course - that's what most of reddit was doing too. As more and more people are accustomed to modern user experiences, more and more of even developers will not want to go through stone walls just to get a simple matching task done. They require quality from their tools. Also, as many people will never become experts, the initial pain will just repeat on, and on, and on, and on. Correction: brudgers and Tiksi - As you may have noticed by now, I did not notice I was talking to two different people, and my comments reflect this. Apologies for the confusion.