L
lgbjr
Hi All,
I'm trying to split a string on every character. The string happens to be a
representation of a hex number. So, my regex expression is ([A-F,0-9]).
Seems simple, but for some reason, I'm not getting the results I expect.
Dim SA as string()
Dim S as string
S="FBE"
SA=RegularExpressions.Regex.Split(S,"([A-F,0-9])")
I expect that SA will contain 3 elements: SA(0)="F", SA(1)="B", SA(2)="E",
but, what I'm getting is 7 elements: SA(0)="", SA(1)="F", SA(2)="",
SA(3)="B", SA(4)="", SA(5)="E", SA(6)="".
If I change the expression to [A-F,0-9] (no parentheses), I get: SA(0)="",
SA(1)="", SA(2)="", SA(3)="".
Just for my own sanity, I've checked the pattern in Expresso and it returns
what I would expect.
I suppose I should mention I'm using VB.NET 2005 (just in case there's a
known issue with Regex in 2005).
TIA
Lee
I'm trying to split a string on every character. The string happens to be a
representation of a hex number. So, my regex expression is ([A-F,0-9]).
Seems simple, but for some reason, I'm not getting the results I expect.
Dim SA as string()
Dim S as string
S="FBE"
SA=RegularExpressions.Regex.Split(S,"([A-F,0-9])")
I expect that SA will contain 3 elements: SA(0)="F", SA(1)="B", SA(2)="E",
but, what I'm getting is 7 elements: SA(0)="", SA(1)="F", SA(2)="",
SA(3)="B", SA(4)="", SA(5)="E", SA(6)="".
If I change the expression to [A-F,0-9] (no parentheses), I get: SA(0)="",
SA(1)="", SA(2)="", SA(3)="".
Just for my own sanity, I've checked the pattern in Expresso and it returns
what I would expect.
I suppose I should mention I'm using VB.NET 2005 (just in case there's a
known issue with Regex in 2005).
TIA
Lee