Skip to content

regex task completed#8

Open
M13G7 wants to merge 2 commits into
Mrsatatima:mainfrom
M13G7:main
Open

regex task completed#8
M13G7 wants to merge 2 commits into
Mrsatatima:mainfrom
M13G7:main

Conversation

@M13G7

@M13G7 M13G7 commented Jun 12, 2021

Copy link
Copy Markdown
Collaborator

This is what i have gotten but I stand to be corrected

Comment thread number_search.py Outdated
with open(text, "r") as f:
text = f.read()
regex = re.compile(char)
matched = regex.findall(text)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any number preceded by anything other than a comma or full stop is not a valid... using the findall will match all the numbers because you did'nt account for it in the pattern.. i suggest you use .split() method

Comment thread number_search.py Outdated
matched = regex.findall(text)
searched_matches = []
for i in range(len(matched)):
if re.compile(r"(?:^[-]?\d+\.? ?,?\d+$|^[-]?\d+$)").search(matched[i]):

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good job
this pattern is almost perfect but try to include comma and fullstop...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants