I'm using this regex to get just a number back.  Regex.Replace(foo, "[^.0-9]", "")   How do I make it not remove spaces?
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);
28537
If I type it in between these parentheses -> () the backward slash inside the parentheses is removed.  As you see it is not there.  However if I surround it with spaces ( \ ), then it is rendered correctly.
30638
I'm struggling to use String.format to replace a token with a value when the token is within single quotes:  Example:  String query = String.format('SELECT Id FROM Availability WHERE Person__c = \'{0}\'', personId);   String query is equal to:  SELECT Id FROM Availability WHERE Person__c = {0}   Rather than:  SELECT Id FROM Availability WHERE Person__c = '234567890'
18468
I'm developing an algorithm to parse a number out of a series of short-ish strings. These strings are somewhat regular, but there's a few different general forms and several exceptions. I'm trying to build a set of regexes that will handle the various forms and exceptions; I'll apply them one after another to see if I get a match.   One of these forms goes something like this:  X (Y) Z   Where:   X is a number I want to capture.  Z is static, pre-defined text. it's basically how I determine whether this particular form is applicable or not. Y is a a string of unknown length and content, surrounded by parenthesis.    Also: Y is optional; it doesn't always appear in a string with Z and X. So, I want to be able to extract the numbers from all of these strings:   10 Z 20 (foo) Z 30 (bar) Z   Right now, I have a regex that will capture the first one:  ([0-9]+) +Z   My problem is that I don't know how to construct a regex that will match a series of characters if and only if they're enclosed in parenthesis. Can this be done in a single regex?
72635
I use the options  \renewcommand{\baselinestretch}{1.25} \setlength{\parskip}{0pt} \setlength{\parindent}{0pt}    in the preamble of my document and most of the time the document looks like intended. Once in a while though, especially when I use multiline-equations, I get huge spaces right before and after the equation and the surrounding text, for example:    Is there any way I can avoid that without removing the \parskip option?
19883
How do I get the substring " It's big \"problem  " using a regular expression?  s = ' function(){  return " It\'s big \"problem  ";  }';
8223
I have been trying to create a find command string that will find all files that end with a number 1-99 but exclude all others.  e.g. I want to find myfile1 myfile99 but not myfile456 and not myfilebackup  The regex I'm thinking of is myfile[1-9]{1,2} but I can't get this to work with find.  find . -regex '.*myfile[0-9]{1,2}' OR  find . -iname 'myfile[0-9]{1,2}'  From what I can see it's the {1,2} part that is not working.  (by the way can you use -name -regex interchangably?)  Any help appreciated.
62677
I am writing a Java utility which helps me to generate loads of data for performance testing.  It would be really cool to be able to specify a regex for Strings so that my generator spits out things which match this.  Is there something out there already baked which I can use to do this?  Or is there a library which gets me most of the way there?  Thanks
33951
Im trying to craft a regex that only returns &lt;link&gt; tag hrefs  Why does this regex return all hrefs including &lt;a hrefs?       (?&lt;=&lt;link\s+.*?)href\s*=\s*[\'\"][^\'\"]+        &lt;link rel="stylesheet" rev="stylesheet"      href="idlecore-tidied.css?T_2_5_0_228" media="screen">     &lt;a href="anotherurl">Slash Boxes&lt;/a>   thank you
3542
I have a value like this:  "Foo Bar" "Another Value" something else   What regex will return the values enclosed in the quotation marks (e.g. Foo Bar and Another Value)?
2827
What's the cleanest, most effective way to validate decimal numbers in JavaScript?  Bonus points for:   Clarity. Solution should be clean and simple. Cross-platform.   Test cases:  01. IsNumeric('-1')      =&gt; true 02. IsNumeric('-1.5')    =&gt; true 03. IsNumeric('0')       =&gt; true 04. IsNumeric('0.42')    =&gt; true 05. IsNumeric('.42')     =&gt; true 06. IsNumeric('99,999')  =&gt; false 07. IsNumeric('0x89f')   =&gt; false 08. IsNumeric('#abcdef') =&gt; false 09. IsNumeric('1.2.3')   =&gt; false 10. IsNumeric('')        =&gt; false 11. IsNumeric('blah')    =&gt; false
2898
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-234-567-8901 x1234 1-234-567-8901 ext1234 1 (234) 567-8901 1.234.567.8901 1/234/567/8901 12345678901   I'll answer with my current attempt, but I'm hoping somebody has something better and/or more elegant.
1707
I have several strings in the rough form:  [some text] [some number] [some more text]   I want to extract the text in [some number] using the Java Regex classes.  I know roughly what regular expression I want to use (though all suggestions are welcome). What I'm really interested in are the Java calls to take the regex string and use it on the source data to produce the value of [some number].  EDIT: I should add that I'm only interested in a single [some number] (basically, the first instance). The source strings are short and I'm not going to be looking for multiple occurrences of [some number].
18554
I'm new to regular expressions and would appreciate your help.  I'm trying to put together an expression that will split the example string using all spaces that are not surrounded by single or double quotes. My last attempt looks like this: (?!") and isn't quite working. It's splitting on the space before the quote.  Example input:   This is a string that "will be" highlighted when your 'regular expression' matches something.   Desired output:  This is a string that will be highlighted when your regular expression matches something.   Note that "will be" and 'regular expression' retain the space between the words.
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?
17187
What is the regular expression for a decimal with a precision of 2?  Valid examples:  123.12 2 56754 92929292929292.12 0.21 3.1   Invalid examples:  12.1232 2.23332 e666.76   The decimal point may be optional, and integers may also be included.
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 ?