-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
possibly Invalid pattern for Passphrase #480
Comments
Thanks for catching these! I'll raise them to the rest of the group |
At least other regex tools seem to allow for this... I'll need to see if I can get something up myself in Rust to check things out... |
Looking into this a bit, and I suspect escaping the [ is not correct; I think the intended regex is:
Update: Disregard; I'm working with someone on what the format really needs to be. |
As ''.join(chr(i) for i in range(ord("#"),ord("~")+1))
"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" which already includes [ and ^ - …, we'll see where this ends up. You can make use of rust regex via from pydantic import BaseModel, Field
class B(BaseModel):
# model_config = dict(regex_engine="python-re")
v: str = Field(pattern=r"(^[ !#-~]+$)|(^Passphrase:[ ^[ !#-~]+$)|(^Hex:[0-9A-Fa-f]{24,96})|(^\*+$)") It'll bail out. |
The regex
are considered invalid by rust regex.
It's accepted by python re.
Yet I think it lacks an escape for the
[
in^[
The text was updated successfully, but these errors were encountered: