Just use \1
… \9
(or $1
… $9
in some regex implementations) like you normally would. The numbering is from left to right, based on the position of the open paren (so a nested group has a higher number than the group(s) it’s nested within).
More Related Contents:
- Is it possible to escape regex metacharacters reliably with sed
- Regex: match everything but a specific pattern
- bash regex with quotes?
- Regular expression for duplicate words
- Regular Expression for alphanumeric and underscores
- How to match multiple occurrences of a substring
- Find and kill a process in one line using bash and regex
- Regular expression to match standard 10 digit phone number
- Regex: matching up to the first occurrence of a character
- Convert a char to upper case using regular expressions (EditPad Pro)
- Why is a character class faster than alternation?
- Regex: Remove lines containing “help”, etc
- How to check if a line is blank using regex
- Why are regular expressions so controversial? [closed]
- Regex matching in a Bash if statement
- Add slash to the end of every url (need rewrite rule for nginx)
- Does lookbehind work in sed?
- Lua pattern matching vs. regular expressions
- R split on delimiter (split) keep the delimiter (split)
- hive regexp_extract weirdness
- Regex with replace in Golang
- Does \w match all alphanumeric characters defined in the Unicode standard?
- Matching an optional substring in a regex
- Invert match with regexp [duplicate]
- extract number after specific string
- Replace string only once with php preg_replace
- Design DFA accepting binary strings divisible by a number ‘n’
- Regex matching beginning AND end strings
- Regex return file name, remove path and file extension
- Matching url with array list of words in AngularJS ui-router