The string a\n should fail validation with the schema Regex("^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:
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 string
a\nshould 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!