Closed Elashi closed 1 year ago
I am trying to substitute a capturing group but it is replaced with more characters than the real matched expression.
Regular expression: "([0-9]{3}.[0-9]{1,})([a-z-()0-9])"gim Testing string: 172.313(a) 172.704(a)(4) 172.704(a)(5)* 172.800(b) Substitution:** $2
(a) (a)(4) (a)(5) (b)**
(a) (a)(4) (a)(5) (b)
Chrome 108.0.5359.125 (Official Build) (64-bit) (cohort: Stable)
Microsoft Windows 10
I was using Substitute ; I should have used List
Bug Description
I am trying to substitute a capturing group but it is replaced with more characters than the real matched expression.
Reproduction steps
Regular expression: "([0-9]{3}.[0-9]{1,})([a-z-()0-9])"gim Testing string: 172.313(a) 172.704(a)(4) 172.704(a)(5)* 172.800(b) Substitution:** $2
Actual Outcome
(a) (a)(4) (a)(5) (b)**
Expected Outcome
(a) (a)(4) (a)(5) (b)
Browser
Chrome 108.0.5359.125 (Official Build) (64-bit) (cohort: Stable)
OS
Microsoft Windows 10