anishmehta24 opened a new pull request, #40399:
URL: https://github.com/apache/beam/pull/40399

   `Regex.find_all(..., group=Regex.ALL)` only returns group 0 and group 1, 
though the docstring says it returns all groups:
   
   ```python
   beam.Create(['a=1 b=2']) | beam.Regex.find_all(r'(\w)=(\d)', beam.Regex.ALL)
   # [[('a=1', 'a'), ('b=2', 'b')]]   group 2 is dropped
   ```
   
   A pattern with no groups raises `IndexError: tuple index out of range`. Each 
match now gives `(m.group(), *m.groups())`, so single-group output is 
unchanged. Added a test for two groups and for no groups; `util_test.py` regex 
tests pass.
   
   Written with help from Claude.
   
   ------------------------
   
    - [ ] Mention the appropriate issue in your description (for example: 
`addresses #123`), if applicable. This will automatically add a link to the 
pull request in the issue. If you would like the issue to automatically close 
on merging the pull request, comment `fixes #<ISSUE NUMBER>` instead.
    - [ ] Update `CHANGES.md` with noteworthy changes.
    - [ ] If this contribution is large, please file an Apache [Individual 
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to