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
These work in conjunction with capturing parentheses. For example, /(foo)/
matches and remembers 'foo' in "foo bar." The matched substring can be recalled from the resulting array's elements [1], ..., [n] or from the predefined RegExp object's properties $1, ..., $9.
In your example, the $1
refers to the match made by (.+)
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp