diff options
author | SammysHP <sven@sammyshp.de> | 2011-09-17 10:41:43 +0200 |
---|---|---|
committer | SammysHP <sven@sammyshp.de> | 2011-09-17 10:41:43 +0200 |
commit | 644b03a25f7b2151fa7bc08fa4601e5babd5c856 (patch) | |
tree | 7aae6b52260ba8098ca89bb157c7b964395c30c7 /main/src/cgeo/geocaching/geopoint | |
parent | b8b32c60cff93d92ac0f8e12a89e22eff830e4f4 (diff) | |
download | cgeo-644b03a25f7b2151fa7bc08fa4601e5babd5c856.zip cgeo-644b03a25f7b2151fa7bc08fa4601e5babd5c856.tar.gz cgeo-644b03a25f7b2151fa7bc08fa4601e5babd5c856.tar.bz2 |
Only - ^ ] \ must be escaped in a character class
See http://www.regular-expressions.info/charclass.html for reference.
Diffstat (limited to 'main/src/cgeo/geocaching/geopoint')
-rw-r--r-- | main/src/cgeo/geocaching/geopoint/DistanceParser.java | 2 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/geopoint/GeopointParser.java | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/main/src/cgeo/geocaching/geopoint/DistanceParser.java b/main/src/cgeo/geocaching/geopoint/DistanceParser.java index e5fbd62..01264c4 100644 --- a/main/src/cgeo/geocaching/geopoint/DistanceParser.java +++ b/main/src/cgeo/geocaching/geopoint/DistanceParser.java @@ -8,7 +8,7 @@ import java.util.regex.Pattern; public final class DistanceParser { - private static final Pattern pattern = Pattern.compile("^([0-9\\.,]+)[ ]*(m|km|ft|yd|mi|)?$", Pattern.CASE_INSENSITIVE); + private static final Pattern pattern = Pattern.compile("^([0-9.,]+)[ ]*(m|km|ft|yd|mi|)?$", Pattern.CASE_INSENSITIVE); /** * Parse a distance string composed by a number and an optional suffix diff --git a/main/src/cgeo/geocaching/geopoint/GeopointParser.java b/main/src/cgeo/geocaching/geopoint/GeopointParser.java index aef054e..a113e10 100644 --- a/main/src/cgeo/geocaching/geopoint/GeopointParser.java +++ b/main/src/cgeo/geocaching/geopoint/GeopointParser.java @@ -13,9 +13,9 @@ import java.util.regex.Pattern; */ public class GeopointParser { - // ( 1 ) ( 2 ) ( 3 ) ( 4 ) ( 5 ) - private static final Pattern patternLat = Pattern.compile("([NS])\\s*(\\d+)°?(?:\\s*(\\d+)(?:[\\.,](\\d+)|'?\\s*(\\d+(?:[\\.,]\\d+)?)(?:''|\")?)?)?", Pattern.CASE_INSENSITIVE); - private static final Pattern patternLon = Pattern.compile("([WE])\\s*(\\d+)°?(?:\\s*(\\d+)(?:[\\.,](\\d+)|'?\\s*(\\d+(?:[\\.,]\\d+)?)(?:''|\")?)?)?", Pattern.CASE_INSENSITIVE); + // ( 1 ) ( 2 ) ( 3 ) ( 4 ) ( 5 ) + private static final Pattern patternLat = Pattern.compile("([NS])\\s*(\\d+)°?(?:\\s*(\\d+)(?:[.,](\\d+)|'?\\s*(\\d+(?:[.,]\\d+)?)(?:''|\")?)?)?", Pattern.CASE_INSENSITIVE); + private static final Pattern patternLon = Pattern.compile("([WE])\\s*(\\d+)°?(?:\\s*(\\d+)(?:[.,](\\d+)|'?\\s*(\\d+(?:[.,]\\d+)?)(?:''|\")?)?)?", Pattern.CASE_INSENSITIVE); private enum LatLon { |