I have asked a question   In which @RomanPerekhrest showed me a different regex syntax.   \(=([^)]*\)) can capture [^)]* as group 1 . This is confusting for me .  You can check the result on            This \(([^\)]*)\) is the correct one in my mind, but it is broken in sed.  So I wonder how to make sed use the regex syntax standard as python or javascript (common standard in many languages).
3017
I wrote a regular expression which works well in a certain program (grep, sed, awk, perl, python, ruby, ksh, bash, zsh, find, emacs, vi, vim, gedit, …). But when I use it in a different program (or on a different unix variant), it stops matching. Why?
111187
If I'm trying to match a quote-delimited string with a regex, which of the following is "better" (where "better" means both more efficient and less likely to do something unexpected):  /"[^"]+"/ # match quote, then everything that's not a quote, then a quote   or  /".+?"/   # match quote, then *anything* (non-greedy), then a quote   Assume for this question that empty strings (i.e. "") are not an issue. It seems to me (no regex newbie, but certainly no expert) that these will be equivalent.   Update: Upon reflection, I think changing the + characters to * will handle empty strings correctly anyway.
78550
I have a format looking like this: 983243 woiewewrsadhjf 234 093111 srewdslkjfdgdsdsf 111  Can i use sed to search for all instances of text in the third field and change only those while leaving other third fields as is? So searching for 111 in the third field, changing all third fields containing 111 into othertext, wile leaving other third fields (such as 234) as they are. If possible can you guys break down the solution so I can get educated on how the command is formed. I am here to learn.
10243
I'm quite confused about the following regular expressions I found in a shell script:  ${0##*/} ${0%/*}   How do they work?
26804
I'm so confused with GNU sed, POSIX sed, and BSD sed's myriad of options.  How do I replace literal \n with the newline character using these three sed types?
4355
For example, this regex  (.*)&lt;FooBar&gt;   will match:  abcde&lt;FooBar&gt;   But how do I get it to match across multiple lines?  abcde fghij&lt;FooBar&gt;
83873
Is it possible to do something like this?  var pattern = /some regex segment/ + /* comment here */     /another segment/;   Or do I have to use new RegExp() syntax and concatenate a string? I'd prefer to use the literal as the code is both more self-evident and concise.
35188
I didn't get the answer to this anywhere. What is the runtime complexity of a Regex match and substitution?  Edit: I work in python. But would like to know in general about most popular languages/tools (java, perl, sed).
9861
How can I use Unicode-aware regular expressions in JavaScript?  For example, there should be something akin to \w that can match any code-point in Letters or Marks category (not just the ASCII ones), and hopefully have filters like [[P*]] for punctuation, etc.
4412
The Python docs say:     re.MULTILINE: When specified, the pattern character '^' matches at the beginning of the string and at the beginning of each line (immediately following each newline)... By default, '^' matches only at the beginning of the string...   So what's going on when I get the following unexpected result?  &gt;&gt;&gt; import re &gt;&gt;&gt; s = """// The quick brown fox. ... // Jumped over the lazy dog.""" &gt;&gt;&gt; re.sub('^//', '', s, re.MULTILINE) ' The quick brown fox.\n// Jumped over the lazy dog.'
17639
Take the following script:  #!/bin/sh sed 's/(127\.0\.1\.1)\s/\1/' [some file]   If I try to run this in sh (dash here), it'll fail because of the parentheses, which need to be escaped. But I don't need to escape the backslashes themselves (between the octets, or in the \s or \1). What's the rule here? What about when I need to use {...} or [...]? Is there a list of what I do and don't need to escape?
7509
I try to write a simple Markdown parser in JavaScript. Therefore I want to check for the [link content][link id] syntax. I use the following code:  data = data.replace( /\[(.*?)\][ ]*\[([0-9]+)\]/g, '&lt;a href="$2"&gt;$1&lt;/a&gt;' );   It works well, but now I want to do this with a RegExp object. So I set up the following bit of code:  var r = new RegExp( '\[(.*?)\][ ]*\[([0-9]+)\]', 'g' ); data = data.replace( r, '&lt;a href="$2"&gt;$1&lt;/a&gt;' );   But it doesn't work. It even says that my regular expression (which works since the first example does a good job) is invalid:     unmatched ) in regular expression   I think it must have to do with some RegExp-object peculiarities I am not aware of. What am I doing wrong and how can the problem be solved?
101473
Why does  grep e\\.g\\. &lt;&lt;&lt; "this is an e.g. wow"   and  grep e\.g\. &lt;&lt;&lt; "this is an e.g. wow"   do the same thing?  If I add a third slash, it also has the same result. BUT, once I add a fourth slash it no longer works. This has to do with a question from an old exam for a class. It asked if the one with two backslashes one would work to output the line with "e.g." I originally thought it wouldn't work, but I tried to make sure and it did. What is the explanation?
118041
Is there any implementation of regex that allow to replace group in regex with lowercase version of it?
39056
This line of code does exactly this except I want it to start at the first character not the 7th. $ echo 1234567890abcdefghijklmnopqrstuvwxy | sed 's/.\{1,7\}\(.\{0,1\}\)/\1/g'  What I'm looking for is 19gow
40669
I want to reverse a regular expression. I.e. given a regular expression, I want to produce any string that will match that regex.  I know how to do this from a theoretical computer science background using a finite state machine, but I just want to know if someone has already written a library to do this. :)  I'm using Python, so I'd like a Python library.  To reiterate, I only want one string that will match the regex. Things like "." or ".*" would make an infinite amount of strings match the regex, but I don't care about all options.  I'm willing for this library to only work on a certain subset of regex.
67376
I’m a newbie in Python. I’m learning regexes, but I need help here.  Here comes the HTML source:  &lt;a href="http://www.ptop.se" target="_blank"&gt;http://www.ptop.se&lt;/a&gt;   I’m trying to code a tool that only prints out http://ptop.se. Can you help me please?