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

Support for matching a pattern repeatedly on the same line #69

Open
harro opened this issue Nov 15, 2019 · 8 comments
Open

Support for matching a pattern repeatedly on the same line #69

harro opened this issue Nov 15, 2019 · 8 comments

Comments

@harro
Copy link
Contributor

harro commented Nov 15, 2019

Breaking out from issue #18, with pull request #38

@itdependsnetworks
Copy link

If breaking out, it would be great to get your interpretation of the potential solution. Hard for an outside reader to decompose based on title and reference alone.

@gachteme
Copy link

support for capture of multiple matches per field per line.

example text to match:
key1:val1, key2:val2, key3:val3 ...
where the number of times this is repeated is arbitrary.

You would think to go about a match as so:

Value keys (\S+)
Value vals (\S+)

Start
  ^({keys}:{vals},\s?)+

but python re does not support this and would only give you key3 and val3.

Pull request adds a dependency to a different regex parsing module which has this functionality and is backwards compatible with re. Other solutions would include post processing (some functionality could be lost), or making repeated matches very general then going through the general match recursively as you strip layers of parenthesis, which would be ugly to implement.

There are examples and test cases in #38 if you want to see the functionality of some edge cases.

@harro harro changed the title Repeat option support Support for matching a pattern repeatedly on the same line Nov 26, 2019
@boniek83
Copy link

boniek83 commented Mar 9, 2020

This is useful. Are you guys planning on merging this anytime soon?

@DanSheps
Copy link

Has there been any movement on this at all?

@giovanni-bellini-argo
Copy link

giovanni-bellini-argo commented Jun 21, 2024

👀 still in future plans?

@harro
Copy link
Contributor Author

harro commented Oct 4, 2024

It's been a while but IIRC the blocker for this is template compatibility. As alternate implementations, such as golang (#64) uses a different regexp engine (or at least they did).

So if the python instance supports regexp functionality that is not a common denominator across implementations then the template libraries would need to be split, as different templates would be required depending on the textfsm instance.

@giovanni-bellini-argo
Copy link

As far as i can see the go implementation linked in the discussion isn't maintained, wouldn't there be more gains in mergin this?

@harro
Copy link
Contributor Author

harro commented Nov 28, 2024

Adding this would preclude using a common template library across implementations, not just the golang implementation above but any implementation (now or in future) that uses this different regexp implementation.

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

No branches or pull requests

6 participants