Re: RegEx Prob. Beats me!
Try the below Regex sample out. One of the differences was to place each character in its own set of brackets, so it looks for a slash, and then an "n".
VB Code:
Dim Test As String = "There once was a\nboy named Freddy \nand he\nliked his big fat Teddy\n"
'using Regex
Dim Matches As System.Text.RegularExpressions.MatchCollection = _
System.Text.RegularExpressions.Regex.Matches(Test, _
"^.*?(?=[\\][n])|(?<=[\\][n]).*?(?=[\\][n])", System.Text.RegularExpressions.RegexOptions.Singleline)
For Each Match As System.Text.RegularExpressions.Match In Matches
MessageBox.Show(Match.Value)
Next
'using just string.repleace
Dim FinalString As String = Test.Replace("\n", Environment.NewLine)
MessageBox.Show(FinalString)
In this case, it might be easier to just use String.Replace, however, learning Regex can be very beneficial in the future if you ever need it...
Re: RegEx Prob. Beats me!
Or use string.split on the \n
Re: RegEx Prob. Beats me!
Okay, getting there. Thx.
Re: RegEx Prob. Beats me!
This tool has helped me with regex. It is called Expresso.
http://www.ultrapico.com/Expresso.htm