[PATCH] Make ISO-6709 coordinate regex less restrictive

Dirk Hohndel dirk at hohndel.org
Mon May 26 15:22:10 PDT 2014


On Tue, May 27, 2014 at 12:03:15AM +0200, José Carlos Andreu Galán wrote:
> -		regExp = QString("(\\d+)[" UTF8_DEGREE "\\s](\\d+)[\'\\s](\\d+)([,\\.](\\d+))?[\"\\s]([NS%1%2])"
> -				 "\\s*(\\d+)[" UTF8_DEGREE "\\s](\\d+)[\'\\s](\\d+)([,\\.](\\d+))?[\"\\s]([EW%3%4])")
> +		regExp = QString("(\\d+)[" UTF8_DEGREE "\\s]\\s*(\\d+)([\'\\s]|\'\\s*)(\\d+)([,\\.]"

same issue, just moved down the line...

([\'\\s]|\'\\s*) is overkill

* allows zero or more
so simply do

[\'\\s]\\s*

that saves you the group and makes the regex easier to read

/D


More information about the subsurface mailing list