cache regex compilation result in PathExpression
add comment and change