I have a string I read from a configuration file. Structure of the string is as follows;
(long_string)long_string(long_string)
Any item in brackets, including the brackets themselves, are optional. I have the following regular expression matching the whole string but I could not figure out how to make some parts of the regular expression optional with "?".
Here are a few valid strings for input
(a)like(1)
like(very long string here)
like
Here is my regexp only matching the first one;
^\((?<short>.*)\)(?<text>.*)\((?<return>.*)\)$
How can I convert my regexp to make brackets optional for a match?