regex reimpl, DP has problem