Extracting multiple values from a string with RegEx
Posted
by
Toni Frankola
on Stack Overflow
See other posts from Stack Overflow
or by Toni Frankola
Published on 2011-01-08T17:43:12Z
Indexed on
2011/01/08
17:54 UTC
Read the original article
Hit count: 248
I have an input string that's generated as in following example:
string.Format("Document {0}, was saved by {1} on {2}. The process was completed
{3} milliseconds and data was received.",
"Document.docx", "John", "1/1/2011", 45);
Generate string looks like this then:
Document Document.docx, was saved by John on 1/1/2011. The process was completed
45 milliseconds and data was received.
Once such a string is received from a different application, what would be the easiest way to parse with regex and extract values Document.docx
, John
, 1/1/2011
, 45
from it.
I am looking for the easiest way to do this as we will have to parse a number of different input strings.
© Stack Overflow or respective owner