summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Petroff <matthew@mpetroff.net>2013-07-30 01:47:12 +0000
committerMatthew Petroff <matthew@mpetroff.net>2013-07-30 01:47:12 +0000
commit90edb3a743ab4e9fc18ff18844cc3624433cd3fc (patch)
tree089c3b986a00f7a014d6f30a10a9dbb049551e3b
parentRemoved SPMetric. (diff)
downloadinkscape-90edb3a743ab4e9fc18ff18844cc3624433cd3fc.tar.gz
inkscape-90edb3a743ab4e9fc18ff18844cc3624433cd3fc.zip
Update unit extraction regular expressions.
(bzr r12380.1.50)
-rw-r--r--src/util/units.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/util/units.cpp b/src/util/units.cpp
index 582c52090..342c9ff32 100644
--- a/src/util/units.cpp
+++ b/src/util/units.cpp
@@ -228,14 +228,14 @@ Quantity UnitTable::getQuantity(Glib::ustring const& q) const
// Extract value
double value = 0;
- Glib::RefPtr<Glib::Regex> value_regex = Glib::Regex::create("\\d+\\.?\\d");
+ Glib::RefPtr<Glib::Regex> value_regex = Glib::Regex::create("[-+]*[\\d+]*\\.*[\\d+]*[eE]*[-+]*\\d+");
if (value_regex->match(q, match_info)) {
value = atof(match_info.fetch(0).c_str());
}
// Extract unit abbreviation
Glib::ustring abbr;
- Glib::RefPtr<Glib::Regex> unit_regex = Glib::Regex::create("[A-z]+");
+ Glib::RefPtr<Glib::Regex> unit_regex = Glib::Regex::create("[A-z%]+");
if (unit_regex->match(q, match_info)) {
abbr = match_info.fetch(0);
}