Revert "Revert "Refactor plugin re""

This reverts commit d6fdef1a997fb6736096646119c0c72e61423c06.
Replace | with \| in RegExp