All Questions

1325
votes
35answers
2120537 views

RegEx match open tags except XHTML self-contained tags

I need to match all of these opening tags: <p> <a href="foo"> But not these: <br /> <hr class="foo" /> I came up with this and wanted to make sure I've got it right. I am...
52
votes
1answers
64765 views

Reference - What does this regex mean?

What is this? This is a collection of common Q&A. This is also a Community Wiki, so everyone is invited to participate in maintaining it. Why is this? regex is suffering from give me ze code ty...
2784
votes
74answers
922783 views

Using a regular expression to validate an email address

Over the years I have slowly developed a regular expression that validates MOST email addresses correctly, assuming they don't use an IP address as the server part. I use it in several PHP programs, ...
778
votes
36answers
753657 views

A comprehensive regex for phone number validation

I'm trying to put together a comprehensive regex to validate phone numbers. Ideally it would handle international formats, but it must handle US formats, including the following: 1-234-567-8901 1-23...
166
votes
1answers
87851 views

Learning Regular Expressions

I don't really understand regular expressions. Can you explain them to me in an easy-to-follow manner? If there are any online tools or books, could you also link to them?
2788
votes
65answers
1891214 views

How to validate email address in JavaScript?

How can an email address be validated in JavaScript?
3241
votes
24answers
2319314 views

Regular expression to match a line that doesn't contain a word?

I know it's possible to match a word and then reverse the matches using other tools (e.g. grep -v). However, I'd like to know if it's possible to match lines that don't contain a specific word (e.g. h...
590
votes
40answers
293221 views

What is the best regular expression to check if a string is a valid URL?

How can I check if a given string is a valid URL address? My knowledge of regular expressions is basic and doesn't allow me to choose from the hundreds of regular expressions I've already seen on the...
174
votes
18answers
48034 views

Using regular expressions to parse HTML: why not?

It seems like every question on stackoverflow where the asker is using regex to grab some information from HTML will inevitably have an "answer" that says not to use regex to parse HTML. Why not? I'm...
29
votes
4answers
18649 views

My regex is matching too much. How do I make it stop?

J0000000: Transaction A0001401 started on 8/22/2008 9:49:29 AM J0000010: Project name: E:\foo.pf J0000011: Job name: MBiek Direct Mail Test J0000100: Machine name: DEV J0000100: Project file: E:\m...

Previous Next