Skip to content
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

Parsing booleans #48

Closed
maelp opened this issue Sep 27, 2021 · 4 comments
Closed

Parsing booleans #48

maelp opened this issue Sep 27, 2021 · 4 comments
Labels
good first issue Good for newcomers

Comments

@maelp
Copy link

maelp commented Sep 27, 2021

Regex::new(r"^true$|^false$|^t$|^f$|TRUE$|^FALSE$|^T$|^F$|^True|^False").unwrap();

Not sure if this is a mistake, but the function comments mentions scanning for "0" and "1" but they seem omitted from the regex

@alexhallam
Copy link
Owner

I need to revisit this. Thanks for pointing it out.

@alexhallam alexhallam added the good first issue Good for newcomers label Sep 28, 2021
@alexhallam
Copy link
Owner

From regex101

I think this should work:

^true$|^false$|^t$|^f$|TRUE$|^FALSE$|^T$|^F$|^True|^False|^1$|^0$

image

@alexhallam
Copy link
Owner

This is open. All that needs to be changed is

Regex::new(r"^true$|^false$|^t$|^f$|TRUE$|^FALSE$|^T$|^F$|^True|^False").unwrap();

to

Regex::new(r"^true$|^false$|^t$|^f$|TRUE$|^FALSE$|^T$|^F$|^True|^False|^1$|^0$").unwrap(); 

@alexhallam alexhallam mentioned this issue Sep 30, 2021
@alexhallam
Copy link
Owner

Closed with #61

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants