How to find regex expression for a string
string str=@"MODULE: X
AVAILABLE BYTES: 3121152
AVAILABLE BYTES: 3121152";
Regex moduleMemory = new Regex("MODULE: Y + .*AVAILABLE BYTES: ([0-9]*)", RegexOptions.Singleline);
Match match = moduleMemory.Match(dataFromDevice);
String mem = match.Groups.Value;
I need to fetch MODULE: Y Available bytes but i guess regular expression is not proper.no match is found.can any one help me to find out regex expression?
Re: How to find regex expression for a string
Well, halfway :)
Regex won't retrieve everything for you - it is just a string filtering system. On MSDN there are literally millions of examples on how to use RegEx. I also think you'll need to do some string manipulation, like for instance, use String.Substring to retrieve the "Module" part.
I hope it helps