summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS10
-rw-r--r--src/generic/apt/matching/pattern.cc4
-rw-r--r--src/generic/apt/matching/pattern.h4
3 files changed, 15 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index 2bb1bc62..5aab4b38 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,16 @@
[6/8/2012]
Version 0.6.9 "All in a days work"
+- New features:
+
+ * [cmdline]: Regular expressions are now supported to match names
+ (same as apt-utils):
+
+ $ aptitude show ^tf$
+
+ Previously this would result in a "no such package"
+ error.
+
- Internal changes:
* Unified the way packages are selected from command line
diff --git a/src/generic/apt/matching/pattern.cc b/src/generic/apt/matching/pattern.cc
index 5743a2a7..75339e1d 100644
--- a/src/generic/apt/matching/pattern.cc
+++ b/src/generic/apt/matching/pattern.cc
@@ -79,7 +79,9 @@ namespace aptitude
bool is_pattern(const std::string &s)
{
- return s.find_first_of("~?") != s.npos;
+ // regex characters are ".?+*|[^$"
+ // pattern characters are "~?"
+ return s.find_first_of("~?.?+*|[^$") != s.npos;
}
}
}
diff --git a/src/generic/apt/matching/pattern.h b/src/generic/apt/matching/pattern.h
index 5aad42f8..96d48550 100644
--- a/src/generic/apt/matching/pattern.h
+++ b/src/generic/apt/matching/pattern.h
@@ -2021,8 +2021,8 @@ namespace aptitude
* This is used in situations where it would be counterintuitive
* for all strings to be treated as search patterns, but where we
* want search patterns to be available. Strings are considered
- * to be seach patterns if they contain a tilde (~) or a question
- * mark (?).
+ * to be seach patterns if they contain a tilde (~), a question
+ * mark (?), or any regex characters (.?+*|[^$).
*
* \return \b true if the string qualifies as a search pattern.
*/