From c46a949904061ddd0521f3d655aa0cbf934a231c Mon Sep 17 00:00:00 2001 From: sairajat Date: Mon, 6 Feb 2017 12:09:35 -0500 Subject: [PATCH] Fixes bug in Pattern::Selection --- source/base/parameter_handler.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source/base/parameter_handler.cc b/source/base/parameter_handler.cc index ccf56d3c9d..128e2410b3 100644 --- a/source/base/parameter_handler.cc +++ b/source/base/parameter_handler.cc @@ -467,6 +467,10 @@ namespace Patterns bool Selection::match (const std::string &test_string) const { std::string tmp(sequence); + // remove whitespace at beginning + while ((tmp.length() != 0) && (std::isspace (tmp[0]))) + tmp.erase (0,1); + // check the different possibilities while (tmp.find('|') != std::string::npos) { @@ -475,6 +479,11 @@ namespace Patterns tmp.erase (0, tmp.find('|')+1); }; + + //remove whitespace at the end + while ((tmp.length() != 0) && (std::isspace (tmp[*(tmp.end()-1)]))) + tmp.erase (tmp.end()-1); + // check last choice, not finished by | if (test_string == tmp) return true; -- 2.39.5