On 8/4/10 8:31 AM, Greg Wooledge wrote: > In fact, putting the ERE-pattern you want to match against into a variable > and then using =~ $variable *is* the recommended practice, if you need to > use =~ at all. It is the only way to get consistent results among all > the different releases of bash that have =~, since the behavior changed > multiple times during the 3.x series.
All this is true (as is the text I removed), except that the behavior changed only once: to make quoted text remove any special meaning of the quoted characters to the regular expression matcher. Backwards compatibility, of course, means never having to say you're sorry, but it also means that you never get to fix anything. The behavior change fixed a problem, as I saw it, with the initial implementation. Without this change, there is no clean way to match a literal character that has a special meaning as a regexp operator. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/