Quote:
Originally Posted by
kurumi
heh, Its easy when the regex is already done for us.
Anyway, if you happen to have it, please post it. I very much like to take a look. thanks in advance.
Hahaha... thanks kurumi, for helping me make a point during this thread.
Yes, regex can be complex, and I have found the online, web-based tools are not very good compared to the fat client ones, like Regex Buddy, that run natively on XP and Wine/Linux.
If you download Regex Buddy (not sure if there is a free version) you can easily find a number of canned complex regex that can extract all the info in URLs, since this is a common task.
Then, if you have some test cases, like cutting-and-pasting an HTML page, like the Google page used in this thread into the tool, you can easily debug, step-by-step.
So putting together a complex regex with the proper tool can be done in a matter of minutes.
I agree that regex can be complex, but just because it is complex, we should not say "it cannot be done only with regex", because I assure you it can.
... and I leave it up to you to do it. However, you may need a proper regex tool (not the simple online ones), and if you have a proper regex tool, you will save (you and your employer) a lot of time and money, because the price of a good regex tool (like Regex Buddy, under $40) can easily save a sys admin or programmer hours of work.
As I mentioned, it is cool to see a number of other solutions, but this is an easy regex problem, with a proper regex tool (complex, without a proper tool). Go get one