How do I use regex to get what is inside of a ${} enclosed value such as:  Dont care about this. ${This is the thing I want regex to return} Not this either.   Should return:  This is the thing I want regex to return   I've tried \${ }$  the best I got messing around on regex101.com I'll be honest I have no Idea what I'm doing as far as regex goes  using on c++ but would also (if possible) like to use in geany text editor
919
Unfortunately, despite having tried to learn regex at least one time a year for as many years as I can remember, I always forget as I use them so infrequently. This year my new year's resolution is to not try and learn regex again - So this year to save me from tears I'll give it to Stack Overflow. (Last Christmas remix).  I want to pass in a string in this format {getThis}, and be returned the string getThis. Could anyone be of assistance in helping to stick to my new year's resolution?    Related questions on Stack Overflow:
104807
Assume I have created a compiled re:  x = re.compile('^\d+$')   Is there a way to extract the pattern string (^\d+$) back from the x?
19642
Is there a grep-like utility that will enable me to do grep searches with logic operators. I want to be able to nest and combine the logical constructs freely. For example, stuff like this should be possible:  grep (term1 &amp;&amp; term2) || (term1 &amp;&amp; (term3 xor term4)) *   I realize this can be done with vanilla grep and additional bash scripting, but my goal here is to avoid having to do that.
10097
Does Java have a built-in way to escape arbitrary text so that it can be included in a regular expression? For example, if my users enter "$5", I'd like to match that exactly rather than a "5" after the end of input.
108524
I need a RegEx pattern for extracting all the properties of an image tag.  As we all know, there are lots of malformed HTML out there, so the pattern has to cover those possibilities.  I was looking at this solution  but it didn't quite get it all:  I come up something like:  (alt|title|src|height|width)\s*=\s*["'][\W\w]+?["']   Is there any possibilities I'll be missing or a more efficient simple pattern?  EDIT: Sorry, I will be more specific, I'm doing this using .NET so it's on the server side. I've already a list of img tags, now I just need to parse the properties.
2830
I want to check if a variable has a valid year using a regular expression. Reading the  I understand I could use the operator =~  Looking at the example below, I would expect to see "not OK" but I see "OK". What am I doing wrong?  i="test" if [ $i=~"200[78]" ] then   echo "OK" else   echo "not OK" fi
54715
The title really says it all, but when I use the @ character to ignore escapes in a string literal @"Like This\", the \" is interpreted as a quote character belonging to the string rather than the terminating quote.
36235
I am after documentation on using wildcard or regular expressions (not sure on the exact terminology) with a jQuery selector.  I have looked for this myself but have been unable to find information on the syntax and how to use it. Does anyone know where the documentation for the syntax is?  EDIT: The attribute filters allow you to select based on patterns of an attribute value.
33382
Can a regular expression match whitespace or the start of a string?  I'm trying to replace currency the abbreviation GBP with a £ symbol. I could just match anything starting GBP, but I'd like to be a bit more conservative, and look for certain delimiters around it.  &gt;&gt;&gt; import re &gt;&gt;&gt; text = u'GBP 5 Off when you spend GBP75.00'  &gt;&gt;&gt; re.sub(ur'GBP([\W\d])', ur'£\g&lt;1&gt;', text) # matches GBP with any prefix u'\xa3 5 Off when you spend \xa375.00'  &gt;&gt;&gt; re.sub(ur'^GBP([\W\d])', ur'£\g&lt;1&gt;', text) # matches at start only u'\xa3 5 Off when you spend GBP75.00'  &gt;&gt;&gt; re.sub(ur'(\W)GBP([\W\d])', ur'\g&lt;1&gt;£\g&lt;2&gt;', text) # matches whitespace prefix only u'GBP 5 Off when you spend \xa375.00'   Can I do both of the latter examples at the same time?
103962
I'm using grep in bash to search for the string "-1" .  I would usually search for "bar" like this ...  glaucon@foo $ grep -irn "bar"   ... which works fine but when I try to search for "-1" I get this ...  glaucon@foo $ grep -irn "-1" Usage: grep [OPTION]... PATTERN [FILE]... Try 'grep --help' for more information.   ... I thought the minus might be a special character but it appears not . I also tried using the 'fixed strings' option in case this was some aspect of regex I was unfamiliar with ...  glaucon@foo $ grep -irnF "-1" Usage: grep [OPTION]... PATTERN [FILE]... Try 'grep --help' for more information.   ... but, as shown, that doesn't provide output either.   I'm sure this is straightforward but ... how ?  Thanks
54053
Why do PHP regexes have the surrounding delimiters? It seems like it would be more clear if any pattern modifiers were passed in as a parameter to whatever function was being used.
107813
I'm looking at the following code snippet:  my @ret = &lt;someMethod&gt; return (undef) if( $DB_ERROR ); return (undef) unless ($#ret &gt;= 0);   Does $# just give you a count of elements in a array?
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.
46012
I am trying to find all matches in a string that begins with | |.    I have tried: if ($line =~ m/^\\\|\s\\\|/) which didn't work.   Any ideas?
47023
Say I have the string "User Name:firstname.surname" contained in a larger string how can I use a regular expression to just get the firstname.surname part?  Every method i have tried returns the string "User Name:firstname.surname" then I have to do a string replace on "User Name:" to an empty string.  Could back references be of use here?  Edit:  The longer string could contain "Account Name: firstname.surname" hence why I want to match the "User Name:" part of the string aswell to just get that value.
117087
I want to search all files in the current directory and below for the substring $form['#node']. So, I have tried, initially:  grep -R "\$form\[\\\\'" . and grep -R "\$form\[\'" .  But it returns no results. However,   grep -R "\$form\[" returns plenty of results, as there are instances of entries such as $form['#id'] or $form['#node'] in the files. Is there any reason why adding the escaped single quote causes an issue? I can't seem to find any clear indication of exactly how to escape a single quote in this case.  I need to check that my escaped characters are working as intended in this scenario.
54866
I want to grab the value of a hidden input field in HTML.  &lt;input type="hidden" name="fooId" value="12-3456789-1111111111" /&gt;   I want to write a regular expression in Python that will return the value of fooId, given that I know the line in the HTML follows the format  &lt;input type="hidden" name="fooId" value="**[id is here]**" /&gt;   Can someone provide an example in Python to parse the HTML for the value?