Trying to parse this and return the following 3 items:
- -30.25 31.46 -27.46 31.74
- -24.57 32.03 -16.86 32.88
- -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 expres开发者_运维知识库sion 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]
\b will not match at the beginning of your input if the first character is a dash (-)
If I correctly understood your sample, try to use this: (-?\d+\.\d+ ?){4}
精彩评论