-
Notifications
You must be signed in to change notification settings - Fork 735
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
regex to match whitespace, words, or mix of both, and cut off trailing whitespace? #566
Comments
Do you have a branch that I could pull down and work off of? |
I think I got it figured...at least with the output I have as an example from my IAP here locally. Thank god for online regex matchers. finally found one and started figuring out how to use it and compare against all the rows in my sample:
And here is some better example output showing some of the various permutations
Here's hoping Aruba's REST API actually gets good soon and returns structured data instead of literally just CLI command output. |
@wmclendon Just wanted to follow up on this. Did you get this working? And is this a template you'd like to submit into the repo? |
@wmclendon I'm going to go ahead and close this. If you'd like to contribute the template back into |
ISSUE TYPE
TEMPLATE USING
SAMPLE COMMAND OUTPUT
SUMMARY
Due to possibility of Name or OS (and possibly Role, not 100% sure yet) having spaces between strings (or just be spaces if name or OS is unknown), my current regex ends up with name for example being '[lots of spaces here]' or similar. Presently I work around that by just iterating over each item and replacing the value with a str.strip(), but i'd like to get it cleaned up where I can contribute these back to the community, which would need to not include this extra step, I think. I haven't explored other Aruba CLI output yet but I expect similar scenarios from other commands as well.
I can't figure out a regex (google-fu is failing me so far) that would allow for Name to match effectively blank entry, a single string, or a string with spaces like "My Laptop", and not also have trailing whitespace at the end. The one in use now I found an example of and then kind of massaged into working for my use cas for the time being, since I can clean up the trailing spaces myself after the fact. As an example one of the records parses as follows:
I am very much a regex noob, so any guidance or help would be greatly appreciated!
Thanks,
Will
The text was updated successfully, but these errors were encountered: