#1028 and #1053. Change options to regex to respect ^ and $ in option -g

v0.27.3
Robin Mills 10 years ago
parent 4b6949df28
commit 0e1b77c8b4

@ -571,7 +571,7 @@ namespace Action {
!result && g != Params::instance().greps_.end(); ++g)
{
#if EXV_HAVE_REGEX
result = regexec( &(*g), key.c_str(), 0, NULL, REG_NOTBOL | REG_NOTEOL) == 0 ;
result = regexec( &(*g), key.c_str(), 0, NULL, REG_EXTENDED) == 0 ;
#else
result = key.find(*g) != std::string::npos;
#endif

@ -151,8 +151,8 @@ static void output(std::ostream& os,const exv_grep_keys_t& greps,const char* nam
!bPrint && g != greps.end() ; ++g
) {
#if EXV_HAVE_REGEX
bPrint = ( 0 == regexec( &(*g), name , 0, NULL, REG_NOTBOL | REG_NOTEOL)
|| 0 == regexec( &(*g), value.c_str(), 0, NULL, REG_NOTBOL | REG_NOTEOL)
bPrint = ( 0 == regexec( &(*g), name , 0, NULL, REG_EXTENDED)
|| 0 == regexec( &(*g), value.c_str(), 0, NULL, REG_EXTENDED)
);
#else
bPrint = std::string(name).find(*g) != std::string::npos || value.find(*g) != std::string::npos;

Loading…
Cancel
Save