From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Lee Newsgroups: gmane.emacs.help Subject: Emacs Lisp vs Perl: Validate Local File Links Date: Fri, 13 Apr 2012 10:35:32 -0700 (PDT) Organization: http://groups.google.com Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1334342116 14859 80.91.229.3 (13 Apr 2012 18:35:16 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 13 Apr 2012 18:35:16 +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:35: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 1SIlKz-000209-B4 for geh-help-gnu-emacs@m.gmane.org; Fri, 13 Apr 2012 20:35:13 +0200 Original-Received: from localhost ([::1]:53828 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SIlKy-0007qj-Br for geh-help-gnu-emacs@m.gmane.org; Fri, 13 Apr 2012 14:35:12 -0400 Original-Path: usenet.stanford.edu!postnews.google.com!8g2000pbm.googlegroups.com!not-for-mail Original-Newsgroups: comp.lang.lisp, comp.emacs, comp.lang.python, comp.lang.perl.misc, gnu.emacs.help Original-Lines: 34 Original-NNTP-Posting-Host: 76.126.112.84 Original-X-Trace: posting.google.com 1334342093 21154 127.0.0.1 (13 Apr 2012 18:34:53 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Fri, 13 Apr 2012 18:34:53 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: 8g2000pbm.googlegroups.com; posting-host=76.126.112.84; posting-account=bRPKjQoAAACxZsR8_VPXCX27T2YcsyMA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.152 Safari/535.19,gzip(gfe) Original-Xref: usenet.stanford.edu comp.lang.lisp:309360 comp.emacs:102397 comp.lang.python:677150 comp.lang.perl.misc:663303 gnu.emacs.help:192041 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:84457 Archived-At: =E3=80=88Emacs Lisp vs Perl: Validate Local File Links=E3=80=89 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: ------------------ =C2=ABOne thing interesting is to compare the approaches in perl and emacs lisp.=C2=BB =C2=ABFor 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 math. This cannot be worked around unless you really start to write a real parser.=C2=BB =C2=ABThe 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.=C2=BB ------------------ 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.) Xah