3 ms·
That's cute and on one hand I like the concept, but on the other hand I find that's exactly how normal terse regexs read to me anyway... ^https?://(?:www\.
by __david__ 13y ago
That's cute and on one hand I like the concept, but on the other hand I find that's exactly how normal terse regexs read to me anyway...
^https?://(?:www\.)?[^ ]*$
is way more succinct and just as easy to read as:
.startOfLine()
.then( "http" )
.maybe( "s" )
.then( "://" )
.maybe( "www." )
.anythingBut( " " )
.endOfLine();
Well... assuming you know regular expressions. Which you should if you are a programmer.
- AdrianRossouw 13y agoi could see it useful if you had a situation where you need to programmatically generate a regex, but i don't really see myself using it much at all.
- xtrumanx 13y agoI kind of know regular expressions but every time I have to write one I head off to regexpal to write it. For instance, off the top of my head, I have no idea what the "?" in the parenthesis does. Usually expect a character to precede a "?", "." or "*". I also don't use them often enough to commit all the rules to memory. However, given VerbalExpressions, I don't think I'd have a problem building regular expressions. For a newbie, startOfLine and endOfLine is far more memorable than "^" and "$". > Which you should if you are a programmer. You can be pretty productive programmer without knowing regular expressions. Depends on the kind of programming you do really.
- AndrewDucker 13y agoThere are ten thousand things I "should" know as a programmer. And I use regular expressions about once per year, which is long enough for them to become unreadable between usages, and require me to spend a chunk of time looking up syntax for even the simplest of them.