We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Consider posting in https://github.com/textualize/rich/discussions for feedback before raising a feature request.
Have you checked the issues for a similar suggestions? Yes. Have not found the request among open issues or PRs.
How would you improve Rich?
I would love to have a Prompt class that can validate string input based on a regex pattern :)
What problem does it solve for you?
It may be the fastest way to implement an string validated prompt.
** Code example **
Probably not the best example implementation but... :)
class RegexPrompt(PromptBase[str]): response_type = str def __init__(self, regex, validate_error_message, *kwargs): super().__init__(kwargs) self._regex = regex self.validate_error_message = "[prompt.invalid]"+validate_error_message def process_response(self, value: str) -> str: if not self._regex.fullmatch(value): raise InvalidResponse(self.validate_error_message) return value
The text was updated successfully, but these errors were encountered:
Thank you for your issue. Give us a little time to review it.
PS. You might want to check the FAQ if you haven't done so already.
This is an automated reply, generated by FAQtory
Sorry, something went wrong.
No branches or pull requests
Consider posting in https://github.com/textualize/rich/discussions for feedback before raising a feature request.
Have you checked the issues for a similar suggestions? Yes. Have not found the request among open issues or PRs.
How would you improve Rich?
I would love to have a Prompt class that can validate string input based on a regex pattern :)
What problem does it solve for you?
It may be the fastest way to implement an string validated prompt.
** Code example **
Probably not the best example implementation but... :)
The text was updated successfully, but these errors were encountered: