support back reference and conditional pattern