I want to write a regular expression that can match the following strings:
OFF
ON
String
Valve
I was thinking to write ^(?<arrivingString>[a-zA-Z]{?})$.
Now I don’t know what to write within the curly brackets, as the value of arriving string is different and random.
Thanks
This matches those 4 words only provided:
This Regex will match every line in it’s entirety provided it starts with any of those 4 strings. The captured group
arrivingStringwill contain whichever of the four words was found.