Peter Volkov wrote: > Hello. > > Please CC my email to answers as I'm not subscribed to the list. > > I have problems using =~ operator. I've tried to search for answer, but > failed. I'm using GNU bash, version 3.1.17. Can anybody give me some > examples of usage? > > I really do not understand why > > $ [[ "string" =~ "[a-z]" ]] && echo something > something > > echo me something. IIUC the regular expression [a-z] matches any single > letter, so how string "string" matches one letter? > > Seems that I missed the point, or did I encounter bug?
regexec(3) returns success for that pattern, so the [[ command succeeds. I'm not sure why, unless it thinks it doesn't have to match the entire string. The real question is whether or not quoting the pattern should work as it does with other [[ pattern matching operators, which is to quote any characters special to the matching engine. I think it should, for consistency. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Live Strong. No day but today. Chet Ramey, ITS, CWRU [EMAIL PROTECTED] http://cnswww.cns.cwru.edu/~chet/ _______________________________________________ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash