Backreferences

Matching Same Text Again & Again

([a-z]\w\s\W\d\D[A-Z][a-zA-Z][aeiouAEIOU]\S)\1

Backreferences to Failed Groups

You have a test string S. Your task is to write a regex which will match S, with following condition(s):

  • S consists of 8 digits.

  • S may have "-" separator such that string S gets divided in 4 parts, with each part having exactly two digits. (Eg. 12-34-56-78)

^\d{2}(-?)\d{2}\1\d{2}\1\d{2}$

Branch Reset Groups

^\d{2}(-(?:--)?|\.|:)\d{2}\1\d{2}\1\d{2}$

Forward References

^(\2tic|(tac))+$

Last updated