Reference · Regular expressions

re.valid

signature
re.valid(any, str | null=) -> bool

What it does

Whether a pattern can be run, for one that comes from data or a person. A pattern that cannot stops re.test and the others, so ask first, or guard the call with ??.

Examples

print(re.valid("a+"))print(re.valid("a+", "i"))print(re.valid("a(?=b)"))
output
truetruefalse
Thread
2Useful? Like it, or add to its thread below.

Thread 0 posts

On re.valid(): questions, tips, corrections, and code that uses it.

No posts yet. The first one opens the thread.

    Edit this page on GitHub · every example's output was made by running it (tools/refcheck.mjs) · questions on Discord or r/quillo