McArthey
McArthey

Reputation: 1646

Pattern matching in C# to remove series in parenthesis

I am using RegularExpressions.Regex to try and match the following text:

(X12345 5/10/2012 21:32) - (X12345 5/14/2012 21:32) - summary text 123

I would like to remove any series of values in parenthesis at the beginning of the string (including any hyphens that exist). Once text is encountered that is not in parenthesis then I'd like to stop the match and return only what was not matched.

For example, I would like to see only "summary text 123" returned from the regex operation.

Thanks for any help!

Upvotes: 0

Views: 105

Answers (1)

Ry-
Ry-

Reputation: 225263

Replace this pattern:

^\s*(\([^)]*\)[\s-]*)+[\s-]*

with nothing.

Upvotes: 3

Related Questions