Domain: regexlib.com
Stories and comments across the archive that link to regexlib.com.
Comments · 10
-
Re:Here's my short list
Do you really think that a thousand if-else statements is more readable than a regex statement. If it takes you one hundred lines of code to test for one condition, then the code becomes less readable, even if each piece makes more sense. RegEx is optimized to test for formatting of a string. This is what it was meant for.
Pseudo-code:
'If Email Address
If (String.RegExMatch("^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$")) Then
'Do Stuff
Else
'Do Other Stuff
End IfAs proof of the point I'm not going to try and program the same functionality with If-Else statements. If you are using regular expressions correctly you leave a human-readable comment explaining what the regular expression matches.
But I think the important point to take away here, is that we can all agree that VB sucks. =)
RegEx copied from regexlib.com
-
Re:Prior Art so Prior It Hurts
Application Patent Date: November 20, 2007
Online Prior Art at the Regex Library from 2004:
^(?!000)([0-6]\d{2}|7([0-6]\d|7[012]))([ -]?)(?!00)\d\d\3(?!0000)\d{4}$
Put that into your favorite Javascript regular expression object and write a stupid onChange reference to it in your HTML and
... tada! Too complicated? Here's some more prior art. Or here. A little bit of Googling must be too much for the USPTO.Are we suddenly shocked to discover one line of code can be patented when a whole mess of code can be patented?
You do realize that is just a patent application publication, and that nothing has actually been patented, right? Just because it's a silly application doesn't prohibit the USPTO from publishing it.
Depending on the backlog for that particular area, it probably hasn't even been picked up by an examiner yet.
-
Prior Art so Prior It HurtsApplication Patent Date: November 20, 2007
Online Prior Art at the Regex Library from 2004:^(?!000)([0-6]\d{2}|7([0-6]\d|7[012]))([ -]?)(?!00)\d\d\3(?!0000)\d{4}$
Put that into your favorite Javascript regular expression object and write a stupid onChange reference to it in your HTML and
... tada! Too complicated? Here's some more prior art. Or here. A little bit of Googling must be too much for the USPTO.
Are we suddenly shocked to discover one line of code can be patented when a whole mess of code can be patented? -
Re:IP and Hardware addressesHere's one that really does check if it's a valid IP:
^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])
\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)
\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)
\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])$If you think, hey that darthdrinker is one smart cookie, than that's cute but it's wrong!
-
Re:Slightly offtopic, Regex related.
Here is another resource I use:
http://www.regexlib.com/RETester.aspx -
Re:Try them out
The Regulator is a nice Open Source tool, but Windows only. It integrates expressions from RegExLib.com, and has syntax highlighting & brace matching.
-
Free Alternative
This is free... And interactive...
http://www.regexlib.com/ -
Re:Email RegEx
As you specified all forms of e-mail addresses...
(I would post one here, but the lameness filter hates it, so I'll just link to it).
Covers RFC 8288, as well as IP addresses. -
Or without a book...
For those who don't want to buy a book, here's a nice page with pre-built regexps for doing all sorts of things: RegexLib.
-
Online resource
I'd be interested to check that book out as I use reg expressions a lot in PHP. But for those of you looking for a resouce online check out RegExLib. I use it often when I'm having trouble putting an expression together and have found it extremely helpful.