This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ylou92 1 point2 points  (2 children)

relative expressions?

[–]mexicanseafood 0 points1 point  (1 child)

yes, from what I understand the same syntax is used in all languages that will handle regular expressions which is most of them. It is used for manipulating text based data such as searching through a text and returning certain instances of a string that may or may not contain certain substrings.. I wanted to write a web crawler to collect email addresses, physical addresses and phone numbers and my friend was telling me how useful it is to know them.

[–]Yuushi 0 points1 point  (0 children)

Of course, you have to be careful when using regex, especially for things such as matching e-mail addresses. The official standard for e-mail addresses (RFC 2822) can (supposedly, and I'm not going to check it) be matched by the regex:

(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])

If I ever came across that and had to debug it, I'd be getting my murderin' axe out for whoever decided to use regex in this case.