On 7 Jun 2008, at 16:48, Toby A Inkster wrote:
Paul Denning wrote:
Can someone provide a regexp for the last path component?
The following Perl-compatible regexp seems to do the trick:
/^
[^\#\?]* # Stuff at front (ignore)
\/([^\/]+)\/? # Last path component
(\?.*)? # Query string (ignore)
(\#.*)? # Fragment (ignore)
$/x
Use the first sub-pattern match as the tag.
That seems to fall apart on "http://example.com" and "http://example.com/foo//
". I tried to throw something together earlier: I couldn't manage
without initially breaking it up into scheme/authority/path/query/
fragment, after which the following worked fine (on the path alone):
/
\/([^\/\?\#]+)\/*
$/x
--
Geoffrey Sneddon
<http://gsnedders.com/>
_______________________________________________
microformats-discuss mailing list
microformats-discuss@microformats.org
http://microformats.org/mailman/listinfo/microformats-discuss