Let's say I have a string WORK-232-3213-2323. Known possible case scenarios:
WORK-232-3213-2323, some text
WORK-232-3213-2323. some text
WORK-232-3213-2323.xlsx
WORK-232-3213-2323 some text
WORK-232-3213-2323/some text
Format WORK-232-3213-2323-some text may also occur, but there is no need to handle this case
My current regex is able to catch needed strings with WORK-232-3213-2323 pattern, but as an output I get -232-3213-2323. How to make it so that it would catch WORK- in string plus rest of the text until next whitespace, dot, slash or comma?
Current regex: WORK-(.*?)[\s]
C#:
Regex pattern = new Regex("WORK-(.*?)[\s]");
string result = pattern.Match(myString).Groups[1].Value