Skip to content

Complete backreference syntax suport

Compare
Choose a tag to compare
@tom-lord tom-lord released this 07 Mar 15:24
· 240 commits to master since this release

There were two types of backreference syntax support missing; now added:

  • Using quotes, instead of angled brackets - e.g. /(a) \k'1'/.examples, /(?<name>xyz) \k'name'/.examples
  • Using RELATIVE group numbers - e.g. /(a)(b) \k<-1>/.examples #=> ["abb"]

Also a very obscure bug fix: Using options toggle "groups" should not increment the groups counter - e.g. the following was previously broken; now fixed:

/(?i)(a)-\1/.examples #=> ["a-a", "A-A"]