NOT
So:
[0-9]
means:
Any digit from 0 through 9
While:
[^0-9]
means:
Any character that is NOT a digit (0–9)
Breaking it down
%
Any number of characters before.
[^0-9]
One character that is not 0–9.
%
Any number of characters after.
Examples
This matches:
ABC123
Because A is not a number.
This matches:
123-45
Because - is not a number.
This matches:
12A34
Because A is not a number.
This does NOT match:
123456
Because every character is a digit.
Example in SQL
WHERE ZipCode LIKE '%[^0-9]%'
This finds ZIP codes that contain something other than numbers.
For example:
98052 ❌ Not returned
98A52 âś… Returned
98-052 âś… Returned
98 052 âś… Returned
Question:
“What does
[^0-9]mean?”
“Inside square brackets, the caret (^) means NOT. So [^0-9] matches any character that is not a digit.”