Reputation: 1
PolygonID SubPolygonID PointID Longitude Latitude AREA_1
1 1 1 103.58792099955456933 0.45318600043361812 Northern Sumatera
1 1 2 103.58810399989971529 0.44205199960015307 Northern Sumatera
1 1 3 103.58190199987745928 0.44590400006961772 Northern Sumatera
1 1 4 103.58061199974406463 0.45378900036212144 Northern Sumatera
1 1 5 103.58309900021873773 0.45947099978684491 Northern Sumatera
1 1 6 103.58792099955456933 0.45318600043361812 Northern Sumatera
1 2 1 103.57287600002746331 0.46851599961371448 Northern Sumatera
I recently work on txt polygon file which contains coordinates for specific points, but in the txt file, I have to adjust the alignment for the columns because several rows in the longitude columns haven't been aligned well. Actually I am expecting it to be :
I am thinking of using notepadd ++ find and replace by regex to sort this thing out but I can't find the correct syntax for finding the mistake pattern. I thought of using (number)\t(number)\t(number)\t(number) and replace it with (number)\t(number)\t(number)\t\t(number) but I don't know how to write it in regex syntax. Can anyone help me with the syntax or even have a better logic to solve this?
Upvotes: 0
Views: 691
Reputation: 43189
You could use:
(((?<=^|\s)[.\d]+)\s+)
This looks for digits or dots, followed by at least one whitespace assuring that what precedes is a whitespace or the beginning of the line. Afterwards, replace the groups with $2\t
, see a demo on regex101.com.
Upvotes: 1
Reputation: 130
Try looking for X number of spaces and replace for the number that you want.
To specify how many spaces you want to look for in regex, you can do this.
...([[:blank:]]{x})...
Upvotes: 0