Parse String with "("

I am trying to parse the version of Windows operating system which looks like this: Win10 10.0.17134.345 (1803). I want the part in the parenthesis.

(following text of first "(" of preceding text of first ")") of operating system

This returns the error: the property 'first <string>' is not defined

1 Like

Got it. I had to change operating system to a string.

following text of first "(" of preceding text of first ")" of (operating system as string)
1 Like

You should generally use plurals, they work better, and I like the form it forces you to use:

preceding texts of firsts ")" of following texts of firsts "(" of (it as string) of operating systems

I also try to keep the flow of relevance from right to left as much as possible.

In this case, doing following texts of firsts "(" of before preceding texts should be more efficient than the other way around due to it resulting in a much shorter string sooner in the parsing process.

One way to compare the relative performance of 2 relevance statements is to run them many times, like this which does both 5000 times:

Q: number of ( preceding texts of firsts ")" of following texts of firsts "(" of (it as string) of operating systems ) of integers in (1,5000)
A: 5000
T: 197.903 ms


Q: number of ( following text of first "(" of preceding text of first ")" of (operating system as string) ) of integers in (1,5000)
A: 5000
T: 203.179 ms

based upon running this many times, it seems like the performance difference in this particular case is negligible and could be due to randomness.

I don’t really understand why using plurals in this case would be better. The result is the same either way, and the syntax is more straight forward. I guess what you are saying is that in general it is a good practice to use plurals.

Plurals are a form of error-handling. For instance if the OS name did not contain any parentheses, a plural would give an empty result while a singular would trigger a relevance error.

In an Analysis, it may not be so bad to see the error result. If the same expression were used in a Fixlet/Task relevance it may at first seem the same - the Task/Fixlet, having silently thrown an error, would also not appear to be Not Relevant. However, if that error-throwing Fixlet is added to a Baseline, it can cause the whole baseline to silently throw an error and appear as Not Relevant, even if there are other relevant components in the same baseline.

You could also use the releaseid inspector to get this info

Q: releaseids of operating system
A: 1803
T: 0.113 ms
I: plural string
3 Likes