Splitting strings?

I have a parameter:

parameter “ustring”="{value “UninstallString” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Symantec NetBackup Client” of native registry}"

And I need to pull out the ObjID for uninstallation from the ‘UninstallString’. The current value being:

“C:\windows\Installer{0B1A79E2-B92A-44B0-9283-2816EC5401E6}\Setup.exe” -u

I need ‘{0B1A79E2-B92A-44B0-9283-2816EC5401E6}’ as a new parameter do perform a custom uninstall.

Any ideas?

1 Like

Hey Andrew, welcome to the forums. For this I suggest using the preceding/following inspectors as @jgstew shows here.

In your case though, it does get tricky since actionscript tries to evaluate text inside curly braces as relevance. So I use the percent encoded values %7B and %7D for { and } respectively.

And since the preceding/following only gets the text between the curly braces, I add them back:

parameter "UninstallGuid" = "{"%7B"}{preceding texts of firsts "%7D" of following texts of firsts "%7B" of (parameter "ustring")}{"%7D"}"

You can also escape the curly braces by doubling them up, but in this case I feel it makes things even more confusing especially at the end:

parameter "UninstallGuid" = "{{{preceding texts of firsts "%7D" of following texts of firsts "%7B" of (parameter "ustring")}{"}}"}"

So in retrospect, pretty darn confusing. :slight_smile: There is probably a more readable way to do this, but at least if no one else replies these should work.

2 Likes

Sean,

Thanks for the prompt reply - this worked like a charm!

2 Likes