[2008] Regular Expressions
Hi,
I'm really, really stuggling with this...
How can I find somethign betwee two strings? Here is an example
start data data data
more data on new line
extra data end
I want it to get everything between "start" and "end". I have tried basic things like: "start(.*)end" with multiple line and ignore case settings but I cant get it to work.
Any help would be greatly appreciated
Re: [2008] Regular Expressions
try this
vb Code:
Dim testStr As String = "start data data data" & Environment.NewLine & _
"more data on new line" & Environment.NewLine & _
"extra data end"
Dim rx As New Regex("(?<=start)(\n| |.)*(?=end)", RegexOptions.IgnoreCase)
MsgBox(rx.Match(testStr).Value)
Re: [2008] Regular Expressions
I am going nuts with regex as well :P anyone care to help me parse "341" out of the string below please:
Re: [2008] Regular Expressions
Quote:
Originally Posted by The_Patzer
I am going nuts with regex as well :P anyone care to help me parse "341" out of the string below please:
you should start a new thread really.
try this
vb.net Code:
Dim testStr As String = "Score 341 0"
Dim rx As New Regex("(?<=Score( )*)\d*(?=( )*0)", RegexOptions.IgnoreCase)
MsgBox(rx.Match(testStr).Value)
it'd be easier without regex:
vb.net Code:
Dim testStr As String = "Score 341 0"
Dim strArray() As String = testStr.Split(New String() {" "}, StringSplitOptions.RemoveEmptyEntries)
msgbox (strArray(1))