I was testing the regex (?=\d)\w(?=\d)
on the string 123abc456
. My expectation was that the positive lookahead (?=\d)
should match 1
and discard it ( since lookaheads are zero length assertions) and then \w
should match2
and the second positive look ahead should just match3
and discard it. Thus, we have an overall match of just 2
.
However, pythex yields the match as 12
and 45
. Where could I be going wrong? Thanks!