You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This appears to only be true for a single trailing newline. Multiple trailing newlines or a leading newline both fail as expected:
python3 -c 'from schema import Regex; Regex("^a$").validate("a\\n\\n")'# this fails
python3 -c 'from schema import Regex; Regex("^a$").validate("\\na")'# as does this
I had a look though the existing issues but can't see this reported anywhere. I'm using the latest version (0.7.5) with Python 3.11.6 on macOS.
Thanks!
The text was updated successfully, but these errors were encountered:
callumgare
changed the title
Trailing newline in value to validate ignored when using regex
[Bug] Trailing newline in value to validate ignored when using regex
Jan 16, 2024
The string
a\n
should fail validation with the schemaRegex("^a$")
but that does not happen. You can see this by running:python3 -c 'from schema import Regex; Regex("^a$").validate("a\\n")'
This appears to only be true for a single trailing newline. Multiple trailing newlines or a leading newline both fail as expected:
I had a look though the existing issues but can't see this reported anywhere. I'm using the latest version (0.7.5) with Python 3.11.6 on macOS.
Thanks!
The text was updated successfully, but these errors were encountered: