|
|
On 17/07/2012 10:40 AM, Warp wrote:
> Invisible<voi### [at] devnull> wrote:
>> On 17/07/2012 07:28 AM, Warp wrote:
>>> Invisible<voi### [at] devnull> wrote:
>>>> In my limited experience, people don't use regexes for simple pattern
>>>> matches.
>>>
>>> Yes, because you have decades of extensive experience on how eg. unix users
>>> typically use regexes.
>
>> Perhaps you mean like
>
> You don't seem to grasp what "the most common usage" means. It does not
> mean "the most prominent examples displayed on webpages" or "the most
> prominent examples that I have seen". It means the forms that people
> *most commonly* use, as in raw numbers. Count how many people use a
> completely syntax-less regex or with just a simple wildcard, vs. the
> times when someone has to write a really large and complex expression.
> I'd estimate that the former wins about a million to one.
Well, you can say "I estimate that it's X", and I can say "well I
estimate that it's Y", and without some actual facts to back any of this
up, it's a bit of an empty discussion.
Also, if the most common search terms really are just literal strings,
that doesn't really prove that regexes are a valuable search tool. It
proves that /literal strings/ are a valuable search tool, no?
>> Or how about
>
>> dmesg | egrep '(s|h)d[a-z]'
>
> If you want to build your straw man, at least use examples that conform
> to your straw man. That's a bad example because it can be understood in
> about 2 seconds.
OK, so what does it do?
Clearly it runs dmesg and searches the output for some search term. But
what is the search term?
>> while(<STDIN>)
>> {
>> my($line) = $_;
>> chomp($line);
>> if($line !~ /<DIR>/)
>> {
>> if ($line =~ /.{28}(\d\d)-(\d\d)-(\d\d).{8}(.+)$/)
>> {
>> my($filename) = $4;
>> my($yymmdd) = "$3$1$2";
>> if($yymmdd lt "971222")
>> {
>> print "copy $filename \\oldie\n";
>> }
>> }
>> }
>> }
>
> Also, if you are building your straw man, at least try to use actual
> regexes and not some unrelated scripting language.
Come on, regexes are the number one use-case for the entire Perl
programming language.
Exhibit A: "Perl" stands for "Practical Extraction and Reporting
Language". Regexes are how Perl does that.
Exhibit B: http://xkcd.com/208/
Perl and regexes are practically synonymous. (Even if /technically/
they're not all that closely related.)
Post a reply to this message
|
|