|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Regex. Split or SplitI'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 Lee,
| I expect that SA will contain 3 elements: SA(0)="F", SA(1)="B", SA(2)="E", I would expect it to contain 4 elements, SA(0)="", SA(1)="", SA(2)="", and | 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)="". SA(3)="", as your string only contains delimiters. RegEx.Split returns the strings between the delimiters, unless you use capturing groups (the parenthesis in your expression) in which case it returns both the strings between the delimiters & the delimiters. The pattern "[A-F,0-9]" returns the 4 that I expect. The capturing groups in your expression is causing RegEx to return the 4 strings between the delimiters, plus the 3 delimiters, ergo 7 values. It sounds like you really want to return the list of matches, rather then the stuff between the delimiters... Try RegEx.Matches, something like: Dim input As String = "FBE" Const pattern As String = "([A-F,0-9])" Static parser As New Regex(pattern) For Each match As Match In parser.Matches(input) Debug.WriteLine(match.Value) Next Hope this helps Jay Show quoteHide quote "lgbjr" <lgbjr@online.nospam> wrote in message news:OlvF7wCQFHA.2356@TK2MSFTNGP14.phx.gbl... | 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 | | Thanks Jay,
I'm an idiot!! an hour or so ago, I was working on a split (really a split), and just continued with split when I should have been using Matches. LOL! Of course, Expresso was giving me the result I expected, because it wasn't trying to split the string! thanks for pointing out what should have been an obvious mistake. Lee Show quoteHide quote "Jay B. Harlow [MVP - Outlook]" <Jay_Harlow_***@msn.com> wrote in message news:%23JuWn9CQFHA.3144@tk2msftngp13.phx.gbl... > Lee, > | 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)="". > I would expect it to contain 4 elements, SA(0)="", SA(1)="", SA(2)="", and > SA(3)="", as your string only contains delimiters. RegEx.Split returns the > strings between the delimiters, unless you use capturing groups (the > parenthesis in your expression) in which case it returns both the strings > between the delimiters & the delimiters. > > The pattern "[A-F,0-9]" returns the 4 that I expect. The capturing groups > in > your expression is causing RegEx to return the 4 strings between the > delimiters, plus the 3 delimiters, ergo 7 values. > > > It sounds like you really want to return the list of matches, rather then > the stuff between the delimiters... Try RegEx.Matches, something like: > > Dim input As String = "FBE" > > Const pattern As String = "([A-F,0-9])" > Static parser As New Regex(pattern) > > For Each match As Match In parser.Matches(input) > Debug.WriteLine(match.Value) > Next > > Hope this helps > Jay > > > > "lgbjr" <lgbjr@online.nospam> wrote in message > news:OlvF7wCQFHA.2356@TK2MSFTNGP14.phx.gbl... > | 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 > | > | > > By the way, the comma in your regex pattern is not part of the syntax
of [] (ie what you actually mean is [A-F0-9] - at the moment you would match , as a hex digit) lgbjr wrote: Show quoteHide quote > Thanks Jay, SA(2)="", and> > I'm an idiot!! an hour or so ago, I was working on a split (really a split), > and just continued with split when I should have been using Matches. LOL! Of > course, Expresso was giving me the result I expected, because it wasn't > trying to split the string! > > thanks for pointing out what should have been an obvious mistake. > > Lee > > "Jay B. Harlow [MVP - Outlook]" <Jay_Harlow_***@msn.com> wrote in message > news:%23JuWn9CQFHA.3144@tk2msftngp13.phx.gbl... > > Lee, > > | 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)="". > > I would expect it to contain 4 elements, SA(0)="", SA(1)="", Show quoteHide quote > > SA(3)="", as your string only contains delimiters. RegEx.Split ([A-F,0-9]).returns the > > strings between the delimiters, unless you use capturing groups (the > > parenthesis in your expression) in which case it returns both the strings > > between the delimiters & the delimiters. > > > > The pattern "[A-F,0-9]" returns the 4 that I expect. The capturing groups > > in > > your expression is causing RegEx to return the 4 strings between the > > delimiters, plus the 3 delimiters, ergo 7 values. > > > > > > It sounds like you really want to return the list of matches, rather then > > the stuff between the delimiters... Try RegEx.Matches, something like: > > > > Dim input As String = "FBE" > > > > Const pattern As String = "([A-F,0-9])" > > Static parser As New Regex(pattern) > > > > For Each match As Match In parser.Matches(input) > > Debug.WriteLine(match.Value) > > Next > > > > Hope this helps > > Jay > > > > > > > > "lgbjr" <lgbjr@online.nospam> wrote in message > > news:OlvF7wCQFHA.2356@TK2MSFTNGP14.phx.gbl... > > | 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 Show quoteHide quote > > | Seems simple, but for some reason, I'm not getting the results I there's aexpect. > > | > > | 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 Show quoteHide quote > > | known issue with Regex in 2005). > > | > > | TIA > > | Lee > > | > > | > > > > Why can't you use the .ToCharArray method of Strings?
Show quoteHide quote "lgbjr" wrote: > Thanks Jay, > > I'm an idiot!! an hour or so ago, I was working on a split (really a split), > and just continued with split when I should have been using Matches. LOL! Of > course, Expresso was giving me the result I expected, because it wasn't > trying to split the string! > > thanks for pointing out what should have been an obvious mistake. > > Lee > > "Jay B. Harlow [MVP - Outlook]" <Jay_Harlow_***@msn.com> wrote in message > news:%23JuWn9CQFHA.3144@tk2msftngp13.phx.gbl... > > Lee, > > | 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)="". > > I would expect it to contain 4 elements, SA(0)="", SA(1)="", SA(2)="", and > > SA(3)="", as your string only contains delimiters. RegEx.Split returns the > > strings between the delimiters, unless you use capturing groups (the > > parenthesis in your expression) in which case it returns both the strings > > between the delimiters & the delimiters. > > > > The pattern "[A-F,0-9]" returns the 4 that I expect. The capturing groups > > in > > your expression is causing RegEx to return the 4 strings between the > > delimiters, plus the 3 delimiters, ergo 7 values. > > > > > > It sounds like you really want to return the list of matches, rather then > > the stuff between the delimiters... Try RegEx.Matches, something like: > > > > Dim input As String = "FBE" > > > > Const pattern As String = "([A-F,0-9])" > > Static parser As New Regex(pattern) > > > > For Each match As Match In parser.Matches(input) > > Debug.WriteLine(match.Value) > > Next > > > > Hope this helps > > Jay > > > > > > > > "lgbjr" <lgbjr@online.nospam> wrote in message > > news:OlvF7wCQFHA.2356@TK2MSFTNGP14.phx.gbl... > > | 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 > > | > > | > > > > > > > Dennis,
Previously, that is exactly what I was doing: Dim SA as Array Dim S as String S="FBE" SA=S.ToCharArray This works fine. but, I'm trying to use Options Strict now, which means I can't use Dim SA as Array I have to use Dim SA as String() And 1-dimensional array of Char can not be converted to 1-dimensional array of String. So, I decided to use a Regex Match to convert the string to a string array. LOL! As I was typing this, I just realized I can do Dim SA as Char(), then use .ToCharArray!! Thanks!! Lee Show quoteHide quote "Dennis" <Den***@discussions.microsoft.com> wrote in message news:1D85F3C7-FC03-4B75-BA56-109445A9BF92@microsoft.com... > Why can't you use the .ToCharArray method of Strings? > > "lgbjr" wrote: > >> Thanks Jay, >> >> I'm an idiot!! an hour or so ago, I was working on a split (really a >> split), >> and just continued with split when I should have been using Matches. LOL! >> Of >> course, Expresso was giving me the result I expected, because it wasn't >> trying to split the string! >> >> thanks for pointing out what should have been an obvious mistake. >> >> Lee >> >> "Jay B. Harlow [MVP - Outlook]" <Jay_Harlow_***@msn.com> wrote in message >> news:%23JuWn9CQFHA.3144@tk2msftngp13.phx.gbl... >> > Lee, >> > | 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)="". >> > I would expect it to contain 4 elements, SA(0)="", SA(1)="", SA(2)="", >> > and >> > SA(3)="", as your string only contains delimiters. RegEx.Split returns >> > the >> > strings between the delimiters, unless you use capturing groups (the >> > parenthesis in your expression) in which case it returns both the >> > strings >> > between the delimiters & the delimiters. >> > >> > The pattern "[A-F,0-9]" returns the 4 that I expect. The capturing >> > groups >> > in >> > your expression is causing RegEx to return the 4 strings between the >> > delimiters, plus the 3 delimiters, ergo 7 values. >> > >> > >> > It sounds like you really want to return the list of matches, rather >> > then >> > the stuff between the delimiters... Try RegEx.Matches, something like: >> > >> > Dim input As String = "FBE" >> > >> > Const pattern As String = "([A-F,0-9])" >> > Static parser As New Regex(pattern) >> > >> > For Each match As Match In parser.Matches(input) >> > Debug.WriteLine(match.Value) >> > Next >> > >> > Hope this helps >> > Jay >> > >> > >> > >> > "lgbjr" <lgbjr@online.nospam> wrote in message >> > news:OlvF7wCQFHA.2356@TK2MSFTNGP14.phx.gbl... >> > | 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 >> > | >> > | >> > >> > >> >> >> lager,
| LOL! As I was typing this, I just realized I can do Dim SA as Char(), then Also depending on what you are doing with the Char(), you may be able to | use .ToCharArray!! simply use the String.Chars property. Something like: Dim S As String S = "FBE" For index As Integer = 0 To S.Length - 1 Dim ch As Char = S.Chars(index) If ch = ","c Then ' do something interesting with the comma End If Next Hope this helps Jay Show quoteHide quote "lgbjr" <lgbjr@online.nospam> wrote in message news:%237y63MJQFHA.2580@TK2MSFTNGP10.phx.gbl... | Dennis, | | Previously, that is exactly what I was doing: | | Dim SA as Array | Dim S as String | S="FBE" | SA=S.ToCharArray | | This works fine. but, I'm trying to use Options Strict now, which means I | can't use | | Dim SA as Array | | I have to use | | Dim SA as String() | | And 1-dimensional array of Char can not be converted to 1-dimensional array | of String. So, I decided to use a Regex Match to convert the string to a | string array. | | LOL! As I was typing this, I just realized I can do Dim SA as Char(), then | use .ToCharArray!! | | Thanks!! | | Lee | | "Dennis" <Den***@discussions.microsoft.com> wrote in message | news:1D85F3C7-FC03-4B75-BA56-109445A9BF92@microsoft.com... | > Why can't you use the .ToCharArray method of Strings? | > | > "lgbjr" wrote: | > | >> Thanks Jay, | >> | >> I'm an idiot!! an hour or so ago, I was working on a split (really a | >> split), | >> and just continued with split when I should have been using Matches. LOL! | >> Of | >> course, Expresso was giving me the result I expected, because it wasn't | >> trying to split the string! | >> | >> thanks for pointing out what should have been an obvious mistake. | >> | >> Lee | >> | >> "Jay B. Harlow [MVP - Outlook]" <Jay_Harlow_***@msn.com> wrote in message | >> news:%23JuWn9CQFHA.3144@tk2msftngp13.phx.gbl... | >> > Lee, | >> > | 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)="". | >> > I would expect it to contain 4 elements, SA(0)="", SA(1)="", SA(2)="", | >> > and | >> > SA(3)="", as your string only contains delimiters. RegEx.Split returns | >> > the | >> > strings between the delimiters, unless you use capturing groups (the | >> > parenthesis in your expression) in which case it returns both the | >> > strings | >> > between the delimiters & the delimiters. | >> > | >> > The pattern "[A-F,0-9]" returns the 4 that I expect. The capturing | >> > groups | >> > in | >> > your expression is causing RegEx to return the 4 strings between the | >> > delimiters, plus the 3 delimiters, ergo 7 values. | >> > | >> > | >> > It sounds like you really want to return the list of matches, rather | >> > then | >> > the stuff between the delimiters... Try RegEx.Matches, something like: | >> > | >> > Dim input As String = "FBE" | >> > | >> > Const pattern As String = "([A-F,0-9])" | >> > Static parser As New Regex(pattern) | >> > | >> > For Each match As Match In parser.Matches(input) | >> > Debug.WriteLine(match.Value) | >> > Next | >> > | >> > Hope this helps | >> > Jay | >> > | >> > | >> > | >> > "lgbjr" <lgbjr@online.nospam> wrote in message | >> > news:OlvF7wCQFHA.2356@TK2MSFTNGP14.phx.gbl... | >> > | 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 | >> > | | >> > | | >> > | >> > | >> | >> | >> | | My Point exactly..why use Regex when one doesn't have to.
Show quoteHide quote "lgbjr" wrote: > Dennis, > > Previously, that is exactly what I was doing: > > Dim SA as Array > Dim S as String > S="FBE" > SA=S.ToCharArray > > This works fine. but, I'm trying to use Options Strict now, which means I > can't use > > Dim SA as Array > > I have to use > > Dim SA as String() > > And 1-dimensional array of Char can not be converted to 1-dimensional array > of String. So, I decided to use a Regex Match to convert the string to a > string array. > > LOL! As I was typing this, I just realized I can do Dim SA as Char(), then > use .ToCharArray!! > > Thanks!! > > Lee > > "Dennis" <Den***@discussions.microsoft.com> wrote in message > news:1D85F3C7-FC03-4B75-BA56-109445A9BF92@microsoft.com... > > Why can't you use the .ToCharArray method of Strings? > > > > "lgbjr" wrote: > > > >> Thanks Jay, > >> > >> I'm an idiot!! an hour or so ago, I was working on a split (really a > >> split), > >> and just continued with split when I should have been using Matches. LOL! > >> Of > >> course, Expresso was giving me the result I expected, because it wasn't > >> trying to split the string! > >> > >> thanks for pointing out what should have been an obvious mistake. > >> > >> Lee > >> > >> "Jay B. Harlow [MVP - Outlook]" <Jay_Harlow_***@msn.com> wrote in message > >> news:%23JuWn9CQFHA.3144@tk2msftngp13.phx.gbl... > >> > Lee, > >> > | 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)="". > >> > I would expect it to contain 4 elements, SA(0)="", SA(1)="", SA(2)="", > >> > and > >> > SA(3)="", as your string only contains delimiters. RegEx.Split returns > >> > the > >> > strings between the delimiters, unless you use capturing groups (the > >> > parenthesis in your expression) in which case it returns both the > >> > strings > >> > between the delimiters & the delimiters. > >> > > >> > The pattern "[A-F,0-9]" returns the 4 that I expect. The capturing > >> > groups > >> > in > >> > your expression is causing RegEx to return the 4 strings between the > >> > delimiters, plus the 3 delimiters, ergo 7 values. > >> > > >> > > >> > It sounds like you really want to return the list of matches, rather > >> > then > >> > the stuff between the delimiters... Try RegEx.Matches, something like: > >> > > >> > Dim input As String = "FBE" > >> > > >> > Const pattern As String = "([A-F,0-9])" > >> > Static parser As New Regex(pattern) > >> > > >> > For Each match As Match In parser.Matches(input) > >> > Debug.WriteLine(match.Value) > >> > Next > >> > > >> > Hope this helps > >> > Jay > >> > > >> > > >> > > >> > "lgbjr" <lgbjr@online.nospam> wrote in message > >> > news:OlvF7wCQFHA.2356@TK2MSFTNGP14.phx.gbl... > >> > | 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 > >> > | > >> > | > >> > > >> > > >> > >> > >> > > >
How are you handling EUL agreement?
Loop ? Binding an Array to a Combo Box How to update an application Panel-height greater Int16.MaxValue? Finding Version of All Asemblies Required by Application repainting problem Category does not exist? How to Publish a Project to Production Server special character inside a string |
|||||||||||||||||||||||