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

Improve Split regex #175

Merged
merged 2 commits into from
Aug 16, 2024
Merged

Improve Split regex #175

merged 2 commits into from
Aug 16, 2024

Conversation

smartycope
Copy link

Added negative and * indecies and quotes to Split parameters

@michaelmior
Copy link
Collaborator

Could you clarify what the purpose is of the changes to the split regex?

@smartycope
Copy link
Author

It does a few things:

  • Allows you to split on spaces and commas by using quotes
  • Allows for negative indexing on the split
  • Allows you to return all the split items as a list, instead of having to select a specific index
  • The regex now allows for optional whitespace between the arguments (just to make the extension a little more pythonic)

@michaelmior
Copy link
Collaborator

@smartycope Thanks! I think it would help to have pieces of the regex documented in the code since it's non-trivial to understand.

I'm also curious why you used (?:\s+)? instead of (?:\s*). Is there some subtle difference I'm missing?

@smartycope
Copy link
Author

@michaelmior I added the documentation you asked for, good thinking.

As for (?:\s+)? vs (?:\s*), I don't know of a difference, that's simply how it was generated.

@michaelmior
Copy link
Collaborator

LGTM, thanks!

@michaelmior michaelmior merged commit d5a766f into h2non:master Aug 16, 2024
7 checks passed
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