skip to content
Alvin Lucillo

Negate characters

/ 1 min read

💻 Tech

To find matched texts containing characters, you can use the square brackets [].

Example regex: Error [123] What it does: Find the literal string first Error then any character that is 1,2, or 3.

Error 1 - matched
Error 2 - matched
Error 3 - matched
Error 4
Error 5

To negate it, just use the hat/caret character ^: Example regex: Error [^123]

Error 1
Error 2
Error 3
Error 4 - matched
Error 5 - matched