|
Posted by Ben C on 11/09/07 10:48
On 2007-11-09, dorayme <doraymeRidThis@optusnet.com.au> wrote:
> In article <slrnfj859a.vl1.spamspam@bowser.marioworld>,
> Ben C <spamspam@spam.eggs> wrote:
>
>> Ticking a box marked "Use Grep" is ironic since "grep" itself is the
>> name of a different ed command ("global regular expression print"),
>> which filters rather than substitutes. It should be called "Use Regex".
>
> You referring to the F & R dialog box in BBEdit for Mac?
Yes.
> In a spiel in the supporting files with BBEdit there is a *note*
> that says:
>
> Grep is the name of a frequently used Unix command that searches
> using regular expressions, the same type of search pattern used
> by BBEdit. For this reason, you will often see regular
> expressions called "grep patterns," as BBEdit does. They're the
> same thing.
Yes, they are the same thing, but I stand by my quibble that "Use Grep"
is a poor choice of name.
The Unix program grep is named after the ed command. What the ed command
does is print out each line of the buffer that matches the pattern. The
grep program does the same: it prints out each line of its input that
matches the pattern. That's not quite the same as Find as Replace. It's
more like Find. The thing they have in common is regular expressions, so
why not call the option that?
Another difficulty is that many of these different programs use slightly
different regular expression syntax. Does BBEdit really use grep
patterns? I think it actually uses the PCRE library (perl-compatible
regular expressions), which are not the same as either grep or egrep
patterns (although closer to egrep). This is important in the real world
because it changes what you need to escape. In a grep pattern ? matches
a ?, and \? means "0 or more". But in an egrep (or PCRE) pattern \?
matches a ? and ? means "0 or more". It's very annoying when you don't
know which you're supposed to be using.
It would be less confusing to normal people and much less confusing to
nerds just to call it "use regex".
[Back to original message]
|