New Feature - Negative Regex
See original GitHub issueHi, first of all, really appreciate all the effort on this fantastic library.
I’d like to suggest what I think is a minor improvement…a negative regex test.
Rationale: It can be quite complex to write the inverse of a regex (negative look ahead etc) and would be much simpler to have the ability to negate the result of the match.
Suggestion: Rather than change the current API, I would suggest negex( regex, message) but entirely up to you.
Apologies if there is another idomatic way of achieving the same outcome.
Background: I’m using tiptap as a Wysiwyg editor. When it’s input is empty, rather than ""
, it returns "<p></>"
. I want to error if the regex does not match /^<p><\/>$/
, rather than if it does. Currently I preprocess the input to coerce "<p></>"
to ""
.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
I’d suggest calling this method
.not
to be in closer agreement with.and
and.or
.Though I’m down to include
.negex
as well - cool name 😃This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.