Top "Backreference" questions

Back references are regular expression constructs that make use of capturing in regex to perform replacement based on parts of the matched string captured during a match sequence in the regexp pattern.

JavaScript - string regex backreferences

You can backreference like this in JavaScript: var str = "123 $test 123"; str = str.replace(/(\$)([a-z]+)/gi, "$2"); This would (quite silly) replace "$…

javascript regex backreference
Notepad++ Regex Backreference syntax in Search/Replace - \1 or $1

I have tried to use the Notepad++ Search/Replace with a Regular Expression to replace specific words with shorter versions …

regex escaping notepad++ replace backreference
Backreferences Syntax in Replacement Strings (Why Dollar Sign?)

In Java, and it seems in a few other languages, backreferences in the pattern are preceded by a backslash (e.…

java regex syntax replace backreference
How to backreference in Ruby regular expression (regex) with gsub when I use grouping?

I would like to patch some text data extracted from web pages. sample: t="First sentence. Second sentence.Third sentence." …

ruby regex reference gsub backreference
Negating a backreference in Regular Expressions

if a string has this predicted format: value = "hello and good morning" Where the " (quotations) might also be ' (single …

regex backreference regex-group negate
PHP - preg_replace backreferencing

I have big problems understanding how to use preg_replace with backreferencing. I have a plain-text string and want to …

php preg-replace backreference
What's the best way to clear regex matching variables?

What's the best way to clear/reset all regex matching variables? Example how $1 isn't reset between regex operations and uses …

regex perl backreference
Extract capture group matches from regular expressions? (or: where is gregexec?)

Given a regular expression containing capture groups (parentheses) and a string, how can I obtain all the substrings matching the …

regex r backreference
Circumvent the sed backreference limit \1 through \9

The sed manual clearly states that the available backreferences available for the replacement string in a substitute are numbered \1 through \9. …

regex shell sed backreference
Problem with RewriteCond %{QUERY_STRING}, backreference not dispaying in final URL

I have the following in my .htaccess file: RewriteCond %{QUERY_STRING} ^route\=product\/category\&path\=35\&page\=([0-9]+)$ RewriteRule ^…

mod-rewrite backreference query-string