Regular Expression to Split Text with \r\n

G

Guest

I havea regular expression to text as pairs key:value
(?<Keyword>\w+):(?<Value>.*)((?=\W$)|\z)

when enter the text as following:
x-sender: (e-mail address removed)
x-receiver: (e-mail address removed)
....blah blah

( I'm using expresso regular expression utility)
I successfull get the results but when enter text as
x-sender: (e-mail address removed)\r\nx-receiver: (e-mail address removed)
....blah blah
the results returned wrong how can I get the key:value results with text
containing \r\n
 
G

Guest

Test for a Regex match on \r\n. If it does not exist, run the current
procedure. If it does exist:

string input = {string you were originallly breaking goes here};
string[] broken= Regex.Split(input, "\r\n");

and then run your original match on each of the strings in broken.

---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top