Re: [apps-discuss] Fun with URLs and regex

Mark Nottingham <mnot@mnot.net> Wed, 28 January 2015 01:57 UTC

Return-Path: <mnot@mnot.net>
X-Original-To: apps-discuss@ietfa.amsl.com
Delivered-To: apps-discuss@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id E85411ACC80 for <apps-discuss@ietfa.amsl.com>; Tue, 27 Jan 2015 17:57:02 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.002
X-Spam-Level:
X-Spam-Status: No, score=-2.002 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, J_CHICKENPOX_25=0.6, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=ham
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id D1wqavNLmu4w for <apps-discuss@ietfa.amsl.com>; Tue, 27 Jan 2015 17:57:01 -0800 (PST)
Received: from mxout-07.mxes.net (mxout-07.mxes.net [216.86.168.182]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 436081ACC83 for <apps-discuss@ietf.org>; Tue, 27 Jan 2015 17:56:57 -0800 (PST)
Received: from [192.168.1.83] (unknown [118.209.44.193]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.mxes.net (Postfix) with ESMTPSA id 9958622E263; Tue, 27 Jan 2015 20:56:55 -0500 (EST)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\))
From: Mark Nottingham <mnot@mnot.net>
In-Reply-To: <54BC3916.7000800@intertwingly.net>
Date: Wed, 28 Jan 2015 12:56:52 +1100
Content-Transfer-Encoding: quoted-printable
Message-Id: <9D9F5DD6-0412-4A46-A3BC-543DBE9A6CB5@mnot.net>
References: <C5B10293-E6F6-4348-9782-C9C00A4476CE@mnot.net> <54BC3916.7000800@intertwingly.net>
To: Sam Ruby <rubys@intertwingly.net>
X-Mailer: Apple Mail (2.1993)
Archived-At: <http://mailarchive.ietf.org/arch/msg/apps-discuss/D24_W9wdciH31Z_W_6rJhyiP3cY>
Cc: IETF Apps Discuss <apps-discuss@ietf.org>
Subject: Re: [apps-discuss] Fun with URLs and regex
X-BeenThere: apps-discuss@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: General discussion of application-layer protocols <apps-discuss.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/apps-discuss>, <mailto:apps-discuss-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/apps-discuss/>
List-Post: <mailto:apps-discuss@ietf.org>
List-Help: <mailto:apps-discuss-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/apps-discuss>, <mailto:apps-discuss-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 28 Jan 2015 01:57:03 -0000

Fixed, thanks!


> On 19 Jan 2015, at 9:52 am, Sam Ruby <rubys@intertwingly.net> wrote:
> 
> On 01/07/2015 04:35 PM, Mark Nottingham wrote:
>> I’ve updated my Python script that serves as a translation of ABNF for URIs into regex.
>> 
>> https://gist.github.com/mnot/138549
> 
> I've attempted to convert this to JavaScript:
> 
> https://url.spec.whatwg.org/reference-implementation/uri-validate.js
> 
> I've built a web page that makes use of it:
> 
> https://url.spec.whatwg.org/reference-implementation/uri-validate.html
> 
> - - -
> 
> Issues I encountered the process:
> 
> 1) file_auth_path is defined with four instead of three double quotes
> 
> 2) the last re.match rejects inputs that do not have a hash sign
> 
> 3) extra, and potentially misleading, output is provided if instr starts with the characters "absolute:".
> 
> - Sam Ruby

--
Mark Nottingham   https://www.mnot.net/