I have come across a piece of code in JScript:
RegExp.$1
Does anybody know what it does?
If I output it on its own, I get nothing not e
$1
will return the first group that matches a regular expression.
In your example, the value stored in $1
is whatever was matching .+
The group is denoted by parenthesis and you can have multiples. Each saved group will just increment the digit with the $
, i.e. $1, $2, $3...
Example:
If your input was __product[Version 12 Coupe]
then $1
would contain Version 12 Coupe