From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Espen Newsgroups: gmane.emacs.help Subject: Re: Emacs Lisp vs Perl: Validate Local File Links Date: Fri, 13 Apr 2012 14:54:44 -0400 Organization: A noiseless patient Spider Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1334343315 24426 80.91.229.3 (13 Apr 2012 18:55:15 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 13 Apr 2012 18:55:15 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Apr 13 20:55:15 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SIleL-00005r-8J for geh-help-gnu-emacs@m.gmane.org; Fri, 13 Apr 2012 20:55:13 +0200 Original-Received: from localhost ([::1]:37990 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SIleK-0007N4-KM for geh-help-gnu-emacs@m.gmane.org; Fri, 13 Apr 2012 14:55:12 -0400 Original-Path: usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!news.stack.nl!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: comp.lang.lisp, comp.emacs, comp.lang.python, comp.lang.perl.misc, gnu.emacs.help Original-Lines: 42 Injection-Info: mx04.eternal-september.org; posting-host="r1I8FMucvIpl17p2khJImw"; logging-data="2346"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18oEn8E2WMei6TqDalRuJBoZuv4QL5Xv9U=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) Cancel-Lock: sha1:pQERcFHNXEHQshue12XhO4PV770= sha1:6ZTLSo2LK0Z2wAr/d6XsWSad0bU= Original-Xref: usenet.stanford.edu comp.lang.lisp:309363 comp.emacs:102398 comp.lang.python:677151 comp.lang.perl.misc:663305 gnu.emacs.help:192042 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:84458 Archived-At: Xah Lee writes: > 〈Emacs Lisp vs Perl: Validate Local File Links〉 > http://xahlee.org/emacs/elisp_vs_perl_validate_links.html > > a comparison of 2 scripts. > > lots code, so i won't paste plain text version here. > > i have some comments at the bottom. Excerpt: > > ------------------ > > «One thing interesting is to compare the approaches in perl and emacs > lisp.» > > «For our case, regex is not powerful enough to deal with the problem > by itself, due to the nested nature of html. This is why, in my perl > code, i split the file by < into segments first, then, use regex to > deal with now the non-nested segment. This will break if you have title="x < href=z" href="math.html">math. This cannot be worked > around unless you really start to write a real parser.» > > «The elisp here is more powerful, not because of any lisp features, > but because emacs's buffer datatype. You can think of it as a > glorified string datatype, that you can move a cursor back and forth, > or use regex to search forward or backward, or save cursor positions > (index) and grab parts of text for further analysis.» > > ------------------ > > If you are a perl coder, and disagree, let me know your opinion. > (showing working code is very welcome) My comment about perl there > applies to python too. (python code welcome too.) Interesting. Perl, Python, and Lisp have real HTML parsers available. I've used the ones for Perl and Python. -- Dan Espen