tags:

views:

42

answers:

2

Trying to parse this and return the following 3 items:

  1. -30.25 31.46 -27.46 31.74
  2. -24.57 32.03 -16.86 32.88
  3. -13.82 33.19 -9.69 33.62

Using this regex expression below I get the matches, but drop the leading "-" at the front of each grouping. I get the "-" in the middle of the group though. Here is the expression I currently use.

Dim regex As New System.Text.RegularExpressions.Regex("\b\-{0,1}\d{1,2}\.{0,1}\d{0,2}\s{1}\-{0,1}\d{1,2}\.{0,1}\d{0,2}\s{1}\-{0,1}\d{1,2}\.{0,1}\d{0,2}\s{1}\-{0,1}\d{1,2}\.{0,1}\d{0,2}\b", RegexOptions.Singleline)

Thanks!

Here is the source text: [Airports]

[Airways]

-30.25 31.46 -27.46 31.74

-24.57 32.03 -16.86 32.88

-13.82 33.19 -9.69 33.62

[Arcs]

+1  A: 

\b will not match at the beginning of your input if the first character is a dash (-)

JoelFan
Thanks, worked like a charm.
Glad to be of help! Tell all your friends SO gave me the answer in 6 minutes! :)
JoelFan
A: 

If I correctly understood your sample, try to use this: (-?\d+\.\d+ ?){4}

Rubens Farias