I have a string, that does not always look the same, and from this string I want to extract some information if it exists. The string might look like one of the following:
myCommand -s 12 moreParameters
myCommand -s12 moreParamaters
myCommand -s moreParameters
I want to get the number, i.e. 12 in this case, if it exists. How can I accomplish that?
Many thanks!
EDIT: There is a fourth possible value for the string:
myCommand moreParameters
How can I modify the regex to cover this case as well?