Ruby 1.9 regex supports lookbehind assertion but I seem to have difficulty when passing anchors in the pattern. When anchors are passed in the lookahead assertion it runs just fine.
"well substring! "[/(?<=^|\A|\s|\b)substring!(?=$|\Z|\s|\b)/] #=> RegexpError: invalid pattern in look-behind: /(?<=^|\A|\s|\b)substring(?=$|\Z|\s|\b)/
Does anybody know how to make anchors work in lookbehind assertions as it does in lookahead?
Is there a special escape sequence or grouping that is required for lookbehind?
I have tested this behavior in 1.9.1-p243, p376 and 1.9.2-preview3 just in case it was patched.