Author Topic: Use regex.split with tab and other delimiters  (Read 1297 times)

0 Members and 1 Guest are viewing this topic.

poncelet

  • Guest
Use regex.split with tab and other delimiters
« on: September 27, 2011, 12:39:42 PM »
Hello people,
I'm trying this:
Code: [Select]
...
Dim point() As String
point = Regex.Split(LineArray(i), vbTab & ",;")
...
with no success

gile

  • Gator
  • Posts: 2520
  • Marseille, France
Re: Use regex.split with tab and other delimiters
« Reply #1 on: September 27, 2011, 01:52:43 PM »
Hi,

If you use the static (Shared in VB) method of the Regex class, you have to separate the expressions in the pattern with the OR operator (|):

Code: [Select]
string[] point = Regex.Split(LineArray[i], ",|;|\t");

You can use the String.Split() method with characters, insted:

Code: [Select]
string[] point = LineArray[i].Split('\t', ',', ';');
« Last Edit: September 27, 2011, 02:06:53 PM by gile »
Speaking English as a French Frog

poncelet

  • Guest
Re: Use regex.split with tab and other delimiters
« Reply #2 on: September 27, 2011, 04:46:31 PM »
 :lol: Thanks gile