Regex.Replace("some big text", "^.+(big).+$", "$1"); // "big"
Regex.Replace("some small text", "^.+(big).+$", "$1"); // "some small text", but i need here empty string
I need to select a value from the string. It's ok, when the string matches the pattern. But when the string doesn't match, there is an original string in replacement res...
            
           
          
            
            Let's say I have the following string :
String in = "A xx1 B xx2 C xx3 D";
I want the result :
String out = "A 1 B 4 C 9 D";
I would like to do it a way resembling the most : 
String out = in.replaceAll(in, "xx\\d",
    new StringProcessor(){
        public String process(String match){ 
            int num = Integer.parseInt(matc...
            
           
          
            
            Just a language feature question, I know there's plenty of ways to do this outside of regexes (or with multiple regexes).
Does ruby support conditional regular expressions?  Basically, an IF-THEN-ELSE branch inside a regular expression, where the predicate for the IF is the presence (or absense) of a captured group in the expression.
I...
            
           
          
            
            Is there any clean way to generate a regular expression that will match values formatted with a locale-configured java NumberFormat?  Or some library that will do so?
This is in a web-based app & I want to pass the regex out to the jsp page for javascript validation on numeric fields.  Locale varies on a per-user basis & I'd like to not...
            
           
          
            
            I have blog data like:
This is foreign <a href="xyz.com">link</a>, this is my site's <a href="mysite.com">link</a> and so on.
What I want is to do is filter the links of foreign sites, i.e "<a href="xyz.com">link</a>". So that my final output is:
This is foreign link, this is my site's <a href="mysite.com">link</a> and so on.
I tri...
            
           
          
            
            Regex Question: how do I replace a single space with a newline in VI.
...
            
           
          
            
            I have an input string like this:
  \pard\nowidctlpar\qj\b0\scaps This
  Agreement\scaps0  is made and entered
  into this date, \{#DATEAGREEMENT#\} ,
  by and between [removed]
  (\ldblquote [removed]\rdblquote ), and its
  successors and/or assigns, with
  address at  [removed], and
  \{#TXTPLAINTIFF#\} , (\ldblquote
  Plaintiff\rdbl...
            
           
          
            
            I have the below code that splits the sql statement and give its indices for the columns. 
String sql = "INSERT INTO Table1(SSN, EMPID) VALUES (?,?)";
    public static List<Object[]> indices(String stmt) {
        List<Object[]> list = new ArrayList<Object[]>();
        String variables[] = null;
        try {
            variables = ...
            
           
          
            
            A simple question for most regex experts I know, but I'm trying to return all matches for the words between some curly braces in a sentence; however Ruby is only returning a single match, and I cannot figure out why exactly.  
I'm using this example sentence:
sentence = hello {name} is {thing}
with this regex to try and return both "...
            
           
          
            
            Hi folks,
I use 
(?<!value=\")##(.*)##
to match string like   ##MyString##   that's not in the form of:
<input type="text" value="##MyString##">
This works for the above form, but not for this: (It still matches, should not match)
<input type="text" value="Here is my ##MyString## coming..">
I tried:
(?<!value=\").*##(.*)##
w...
            
           
          
            
            I have the following statement:
if ($(this).find("option[text='My Cool Option1']").is(":selected"))
  //do something
basically I have a combobox with many options. I want to do something for options that start with My Cool Option<any number>
above code works for only one option My Cool Option1...but how do I make it work for say My C...
            
           
          
            
            I'm trying the following segment to no avail:
 public class test {
    public static void main(String args[] ){
       String password = "s8bgBQYPmUaNjkToXCJLAwAA";
       System.out.println( Pattern.matches("[0-9]", password ));
   }
}
I would expect that to work since I'm just looking for match of any digit to suffice the regex ...
            
           
          
            
            I have a regular expression here, and I want it to return only users, comments, and posts. However, even though I have \s, whitespace, in my negative character set, it still is extracting a match from it. Why is this?
...
            
           
          
            
            I am trying to make a height (person height) and weight validation.
Height should look something like this: 5'11"
Anything in any other different format should show up as wrong.
What should I use for ValidationExpression?
and onee more question "[10-200].(1[0-1]|\d)" is this correct for weight validation 
...
            
           
          
            
            I can get it to remove all the question marks with the code below:
preg_replace('/(\?+)/', '', $string)
No matter what I seem to do I can't get it to also remove all the minus signs as well.  Everything I try just breaks the whole regex.
...
            
           
          
            
            It is necessary regexp to replace in a line of a colon with blanks, excepting situations where a colon the first and (or) last symbol - them is simply deleted.
Example1
"6:206:НР" -> "6 206 НР"
Example2
":206:" -> "206"
...
            
           
          
            
            Hi I'm new to Ruby and regular expressions.  I'm trying to use a regular expression to remove any zeros from the month or day in a date formatted like "02/02/1980" => "2/2/1980"   
def m_d_y
  strftime('%m/%d/%Y').gsub(/0?(\d{1})\/0?(\d{1})\//, $1 + "/" + $2 + "/" )
end
What is wrong with this regular expression?
Thanks.
...
            
           
          
            
            I have the following code:
#$domain = domainname.co.uk
#$root = public_html
#$webpage = domainname.co.uk/foo/bar/foobar.html
my $string = ($webpage =~ s/^$domain//g);
my $linkFromRoot = $dbh->quote($root . $string);
Usualy this works fine but for some reason the output is "public_html 1" instead of "public_html/foo/bar/foobar.html".
...
            
           
          
            
            I want to parse incoming CSV-like rows of data. Values are separated with commas (and there could be leading and trailing whitespaces around commas), and can be quoted either with ' or with ". For example - this is a valid row:
    data1, data2  ,"data3'''",  'data4""',,,data5,
but this one is malformed:
    data1, data2, da"ta3", 'd...
            
           
          
            
            How do I do this? I've seen a solution not using a single regex for ruby becauase ruby doesn't support loookaround assertions. But is it possible in c#?
[Test]
public void RarArchiveFirstFileNameShouldMatch() {
    var regex = new Regex(@"\.(rar|001)$", RegexOptions.IgnoreCase | RegexOptions.Singleline);
    Assert.That(regex.IsMatch("f...