settings: enable regexes by default and add support for perl syntax

This commit is contained in:
Andrzej Rybczak
2015-05-02 15:05:50 +02:00
parent dafcadefaf
commit 8f646e0f5c
4 changed files with 8 additions and 4 deletions

2
NEWS
View File

@@ -15,6 +15,8 @@ ncmpcpp-0.7 (????-??-??)
* Current MPD host may now be shown in playlist (playlist_show_mpd_host configuration variable, disabled by default). * Current MPD host may now be shown in playlist (playlist_show_mpd_host configuration variable, disabled by default).
* Random album artists can now be added to the playlist. * Random album artists can now be added to the playlist.
* Case insensitive searching is now Unicode aware as long as boost was compiled with ICU support. * Case insensitive searching is now Unicode aware as long as boost was compiled with ICU support.
* Searching with regular expressions are now enabled by default.
* Support for the Perl regular expression syntax was added.
ncmpcpp-0.6.3 (2015-03-02) ncmpcpp-0.6.3 (2015-03-02)

View File

@@ -432,9 +432,9 @@
# #
#display_remaining_time = no #display_remaining_time = no
# #
## Available values: none, basic, extended. ## Available values: none, basic, extended, perl.
## ##
#regular_expressions = none #regular_expressions = basic
# #
## ##
## Note: If below is enabled, ncmpcpp will ignore leading ## Note: If below is enabled, ncmpcpp will ignore leading

View File

@@ -287,7 +287,7 @@ If enabled, bitrate of currently playing song will be displayed in statusbar.
.B display_remaining_time = yes/no .B display_remaining_time = yes/no
If enabled, remaining time of currently playing song will be be displayed in statusbar instead of elapsed time. If enabled, remaining time of currently playing song will be be displayed in statusbar instead of elapsed time.
.TP .TP
.B regular_expressions = basic/extended .B regular_expressions = none/basic/extended/perl
Type of currently used regular expressions. Type of currently used regular expressions.
.TP .TP
.B ignore_leading_the = yes/no .B ignore_leading_the = yes/no

View File

@@ -578,10 +578,12 @@ bool Configuration::read(const std::vector<std::string> &config_paths)
regex_type = boost::regex::basic; regex_type = boost::regex::basic;
else if (v == "extended") else if (v == "extended")
regex_type = boost::regex::extended; regex_type = boost::regex::extended;
else if (v == "perl")
regex_type = boost::regex::perl;
else else
throw std::runtime_error("invalid argument: " + v); throw std::runtime_error("invalid argument: " + v);
regex_type |= boost::regex::icase; regex_type |= boost::regex::icase;
}, defaults_to(regex_type, boost::regex::literal | boost::regex::icase) }, defaults_to(regex_type, boost::regex::basic | boost::regex::icase)
)); ));
p.add("ignore_leading_the", yes_no( p.add("ignore_leading_the", yes_no(
ignore_leading_the, false ignore_leading_the, false