asweigart / asweigart/pyinputplus

allowRegexes doesn't seem work properly

Open
#20 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
114
Forks
19
PR merge metrics
No merged PRs in 30d

Description

`response = pyip.inputNum(allowRegexes=[r'(i|v|x|l|c|d|m)+', r'zero'])`
This code is prestented in the book Automate The Boring Stuff With Python.
'asdf' is a valid input for this code and the return value of this input is 'asdf'
Is this code designed to do this?
`mo = re.search(r'(i|v|x|l|c|d|m)+', 'asdf')`
only returns 'd'
I'm only a beginner, so this is kind of confusing.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the `pyip.inputNum(allowRegexes=...)` example and inspect how `inputNum` applies the supplied regular expressions, comparing it with the shown `re.search` result. Done means determining whether `asdf` should be accepted and, if behavior is incorrect, adding a regression test for the demonstrated input.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.