(imported topic written by brolly3391)
Using relevance, I want to turn this string:
Office (Network),9AA,CN=Brolly M Brolly/OU=XXX/OU=YYY/OU=US/O=Company
into this string:
Caveats:
Brolly M Brolly is a name and might have a different number of items, such as Brolly Brolly or Brolly M Brolly III.
There will be no “/” or “=” characters in the name.
There are an undertermined number of OU= entries in the middle of the string, each delimited with “/”.
My first approach
q: substrings separated by “,” of string “Office (Network),9AA,CN=Brolly M Brolly/OU=XXX/OU=YYY/OU=US/O=Company”
A: Office (Network)
A: 9AA
A: CN=Brolly M Brolly/OU=XXX/OU=YYY/OU=US/O=Company
T: 0.152 ms
I: plural substring
OR
q: substrings separated by “/” of substring after “CN=” of string “Office (Network),9AA,CN=Brolly M Brolly/OU=XXX/OU=YYY/OU=US/O=Company”
A: Brolly M Brolly
A: OU=XXX
A: OU=YYY
A: OU=US
A: O=Company
T: 0.196 ms
I: plural substring
How do I choose just the first and last substrings in my plural substring set for further parsing? I reviewed the Windows Inspector Library but I did not find much on how to work with plural objects. I would really love to learn how to process plurals so that I can move forward with this approach.
And the second approach, avoiding plural substrings
q: ((preceding text of first “/” of it & “@” & following text of last “O=” of it & “.com” )of substring after “CN=” of string “Office (Network),9AA,CN=Brolly M Brolly/OU=XXX/OU=YYY/OU=US/O=Company”) as lowercase
A: brolly m brolly@company.com
T: 0.262 ms
I: singular string
It’s messy, and it works but it does not teach me anything new about handling plurality. And there is still the question of replacing the spaces in the name with dots without knowing how many spaces there will be.
Any ideas, gang?