!! Version 2 !! test basic rmatch with successful match !! wikitext {{#rmatch:this is some page content|\bcontent$|it matched|did not match}} !! html

it matched

!! end !! test basic rmatch with failed match !! wikitext {{#rmatch:this is some page content|^not matching regex|it matched|did not match}} !! html

did not match

!! end !! test successful rmatch with backreference !! wikitext {{#rmatch:this is some page content|^(.+)\s\bcontent$|it expands backreference: $1|did not match}} !! html

it expands backreference: this is some page

!! end !! test successful rmatch with second backreference !! wikitext {{#rmatch:this is some page content|^(.+)\s\bsome\s(.+)\s\bcontent$|it expands backreference: $2|did not match}} !! html

it expands backreference: page

!! end !! test successful rmatch with spurious capturing group !! wikitext {{#rmatch:this is some page content|^(.+)\s\bcontent$|this is a spurious backref: $52 will be removed|did not match}} !! html

this is a spurious backref: will be removed

!! end