I am trying to use a regexp to search on the string “SSS”. If this string is found in a particular segment, then capture all characters which come BEFORE the “SSS” and save them to a variable.
The issue is the fact that the regexp does not search on “SSS”, but rather just “S”. So, if a capital S appears anywhere before the “SSS”, all of the logic is blown for the rest of the script.
The string I am testing with is: General SisterSSS001ABC123 Information
If the regexp works correctly, the appropriate output would be “Sister” to the caputuring variable.
I have tried the following options and have not gotten the desired result:
A. regexp {(^[SSS]*)}
A1. Output: S
B. regexp {(^(SSS)*)}
B1. Output:
C. regexp {([^”SSS”]*)}
C1. Output:
I have tried a few other variations, but in all cases, the regexp continues to focus on the first instance of “S” and not the “SSS”. Does anyone know the syntax to isolate a string of the same letters using regexp?
Thanks,