I am using a string which contains a regex expression to validate an email, the email is validating properly,unless a "+" symbol is included in the email. if someone has a email id suppose like this "billgates+apple@gmail.com", so at this point my regex is not working itz giving me a invalid username message,for else email id itz working fine here is my regex   string strPattern = "^([0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\\w]*[0-9a-zA-Z]\\.)+[a-zA-Z]{2,9})$";   I tried using other regex which validates for special symbols but still i have the same error.   string strPattern = "^[a-zA-Z0-9]+([a-zA-Z0-9_.\\$&amp;-]+)*@[a-zA-Z0-9]+([a-zA-Z0-9_.\\$&amp;-]+)*\\.([a-zA-Z0-9]{2,4})$";   if anyone can help out,it will be usefull,thanx
835
Over the years I have slowly developed a  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, and it works most of the time.  However, from time to time I get contacted by someone that is having trouble with a site that uses it, and I end up having to make some adjustment (most recently I realized that I wasn't allowing 4-character TLDs).  What is the best regular expression you have or have seen for validating emails?  I've seen several solutions that use functions that use several shorter expressions, but I'd rather have one long complex expression in a simple function instead of several short expression in a more complex function.
89095
I need to match a space character in a PHP regular expression. Anyone got any ideas?  I mean like "gavin schulz", the space in between the two words. I am using a regular expression to make sure that I only allow letters, number and a space. But I'm not sure how to find the space. This is what I have right now:  $newtag = preg_replace("/[^a-zA-Z0-9s|]/", "", $tag);
8109
I want to match a portion of a string using a  and then access that parenthesized substring:  var myString = "something format_abc"; // I want "abc"  var arr = /(?:^|\s)format_(.*?)(?:\s|$)/.exec(myString);  console.log(arr);     // Prints: [" format_abc", "abc"] .. so far so good. console.log(arr[1]);  // Prints: undefined  (???) console.log(arr[0]);  // Prints: format_undefined (!!!)   What am I doing wrong?    I've discovered that there was nothing wrong with the regular expression code above: the actual string which I was testing against was this:  "date format_%A"   Reporting that "%A" is undefined seems a very strange behaviour, but it is not directly related to this question, so I've opened a new one, .    The issue was that console.log takes its parameters like a printf statement, and since the string I was logging ("%A") had a special value, it was trying to find the value of the next parameter.
10138
I received the following exception when I was using the Regex class with the regular expression: (?'named a'asdf)  System.ArgumentException: parsing \"(?'named a'asdf)\" - Invalid group name: Group names must begin with a word character.   What is the problem with my regular expression?
2660
I need to find a reg ex that only allows alphanumeric. So far, everyone I try only works if the string is alphanumeric, meaning contains both a letter and a number. I just want one what would allow either and not require both.
108459
Are Python and JavaScript regular expression syntax identical?   If not, then:    What are the important differences between them Is there a python library that "implements" JavaScript regexps?
108707
You can search for anything on Google, right? At least, so I thought. I was trying to see how the special characters get encoded in the url, like how &amp; gets converted to %26. I started searching for *. It did not get encoded, but weirdly google didn't tell me that it was an asterisk symbol. All other search engines (yahoo, bing, duckduckgo) did.   See for yourself : . Basically it treats it as a regular expression. So *+* will also not give any results. Still, shouldn't Google at least say that * is the asterisk symbol.  I don't know where else to ask this question, so I came to SO.
12151
What characters/symbols are allowed within the CSS class selectors? I know that the following characters are invalid, but what characters are valid?  ~ ! @ $ % ^ &amp; * ( ) + = , . / ' ; : " ? &gt; &lt; [ ] \ { } | ` #
114295
What are the valid characters to use in labels? I thought that only alphabetic characters were valid, but I tested ' and ! and they work. What are the restrictions to these names?
78594
It is my understanding that the java.regex package does not have support for named groups () so can anyone point me towards a third-party library that does?  I've looked at  but its last release was in 2002 and it didn't work for me (admittedly I only tried briefly) under java5.
38100
I have this regex I built and tested in regex buddy.  "_ [ 0-9]{10}+ {1}+[ 0-9]{10}+ {2}+[ 0-9]{6}+ {2}[ 0-9]{2}"   When I use this in .Net C#   I receive the exception  "parsing \"_ [ 0-9]{10}+ +[ 0-9]{10}+  +[ 0-9]{6}+  [ 0-9]{2}\" - Nested quantifier +."   What does this error mean? Apparently .net doesn't like the expression.  Here is the regex buddy so u can understand my intention with the regex...  _ [ 0-9]{10}+ {1}+[ 0-9]{10}+ {2}+[ 0-9]{6}+ {2}[ 0-9]{2}  Match the characters "_ " literally «_ » Match a single character present in the list below «[ 0-9]{10}+»    Exactly 10 times «{10}+»    The character " " « »    A character in the range between "0" and "9" «0-9» Match the character " " literally « {1}+»    Exactly 1 times «{1}+» Match a single character present in the list below «[ 0-9]{10}+»    Exactly 10 times «{10}+»    The character " " « »    A character in the range between "0" and "9" «0-9» Match the character " " literally « {2}+»    Exactly 2 times «{2}+» Match a single character present in the list below «[ 0-9]{6}+»    Exactly 6 times «{6}+»    The character " " « »    A character in the range between "0" and "9" «0-9» Match the character " " literally « {2}»    Exactly 2 times «{2}» Match a single character present in the list below «[ 0-9]{2}»    Exactly 2 times «{2}»    The character " " « »    A character in the range between "0" and "9" «0-9»   In short...  What is a Nested quantifier?
26213
I can't seem to find an answer to this problem, and I'm wondering if one exists. Simplified example:  Consider a string "nnnn", where I want to find all matches of "nn" - but also those that overlap with each other. So the regex would provide the following 3 matches:   nnnn nnnn nnnn   I realize this is not exactly what regexes are meant for, but walking the string and parsing this manually seems like an awful lot of code, considering that in reality the matches would have to be done using a pattern, not a literal string.
59657
Regex.IsMatch( "foo", "[\U00010000-\U0010FFFF]" )    Throws: System.ArgumentException: parsing "[-]" - [x-y] range in reverse order.  Looking at the hex values for \U00010000 and \U0010FFF I get: 0xd800 0xdc00 for the  first character and 0xdbff 0xdfff for the second.  So I guess I have really have one problem. Why are the Unicode characters formed with \U split into two chars in the string?
34252
I want to validate the field for US format phone number(478-857-4578). I used the below code, it works fine for all but one scenario.  If I enter only 4 digit number or below than, the error message     The validation formula has evaluated to an error   is displayed.   But for all other wrong inputs, my custom error message     Please enter phone number in 214-587-5485 format   is displayed.  I wanted to display my custom error message for all invalid inputs. Do I need to change anything in formula?  Formula:  =AND( LEN([num])=12,     IF(ISERROR(FIND("-", [num],4)),         FALSE,         (FIND("-", [num], 4) = 4)     ),     IF(ISERROR(FIND("-", [num],8)),         FALSE,         (FIND("-", [num], 8) = 8)     ),     IF(ISERROR(1*CONCATENATE(MID([num], 1, 3), MID([num], 5, 3), MID([num], 9, 4))),         FALSE,         AND(             1*CONCATENATE(MID([num], 1, 3), MID([num], 5, 3), MID([num], 9, 4)) &gt; 1000000000,             1*MID([num], 1, 3) &lt;&gt; 911,             1*MID([num], 5, 3) &lt;&gt; 911         )     ) )
123543
I wonder if there is an easy way to check if two strings match by excluding certain characters in the strings. See example below.  I can easily write such a method by writing a regular expression to find the "wild card" characters, and replace them with a common character. Then compare the two strings str1 and str2. I am not looking for such implementations, but like to know whether there are any .Net framework classes that can take care of this. Seems like a common need, but I couldn't find any such method.  For example:  string str1 = "ABC-EFG";     string str2 = "ABC*EFG";   The two strings must be declared equal.  Thanks!
39085
I'm wondering what's the difference between using * and .* in a regex string.  I guess, * stands for "0 to n characters" but I don't see what .* stands for.  For example, what is the difference between: "2013*11*27" and "2013.*11.*27"? If I take a look to   find . -name [pattern]   As pattern I tried : "2013.*11.*25" and it didn't find "2013-11-25" however, with "2013*11*25", it finds it.   Why ?  In unix, 0 or n occurences of wildcards is : *, in regex .* so why doesn't it work ?
37476
What is the easiest way to match non-ASCII characters in a regex? I would like to match all words individually in an input string, but the language may not be English, so I will need to match things like ü, ö, ß, and ñ. Also, this is in Javascript/jQuery, so any solution will need to apply to that.