regex substring C#

Posted by sharma on Stack Overflow See other posts from Stack Overflow or by sharma
Published on 2011-01-14T17:19:46Z Indexed on 2011/01/14 17:53 UTC
Read the original article Hit count: 491

Filed under:
|

Hi,

I need help to figure the regex expression

I have

string = "STATE changed from [Fixed] to [Closed], CLOSED DATE added [Fri Jan 14 09:32:19 
MST 2011], NOTES changed from [CLOSED[]<br />] to [TEST CLOSED <br />]"

I need to grab NOTES changed from [CLOSED[]<br />] to [TEST CLOSED <br />] and take values CLOSED[] and TEST CLOSED in two string variables.
So far I got to:

Regex NotesChanged = new Regex(@"NOTES changed from \[(\w*|\W*)\] to \[([\w-|\W-]*)\]");

which matches only if "NOTES changed from" started at the beginning and has no '[]' within '[ ]', but I have "[CLOSED[]]" and also no "
". Any ideas on what to change in regex.

Thanks, Sharma

© Stack Overflow or respective owner

Related posts about c#

Related posts about regex