💾 Archived View for rawtext.club › ~sloum › geminilist › 007566.gmi captured on 2023-12-28 at 15:56:55. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-11-30)
-=-=-=-=-=-=-
Alex // nytpu alex at nytpu.com
Mon Nov 8 20:01:38 GMT 2021
- - - - - - - - - - - - - - - - - - -
On 2021-11-08 08:07PM, codesoap at mailbox.org wrote:
Hi all,
=
[<whitespace>]<URL>[<whitespace><USER-FRIENDLY LINK NAME>]
From this description I don't know whether <USER-FRIENDLY LINK NAME>
MAY be empty. Which of these regular expressions would be correct to
parse a link line?
The user friendly link name is optional, however if it is presentthen the whitespace after the url is mandatory as well. In other words,the URL is mandatory, and you either have no link name and no spaceafter the URL or a link name and mandatory space(s) after the URL.
So you have the following possibilities for link lines:=
url <- no link name, no space between => and url=
url <- no link name, one or more spaces separating=>url name <- link name present, no space between => and url=
url name <- link name present, one or more spaces separating
a) ^=>[ \t]*([^ \t]+)(?:$|[ \t]+([^ \t].*)$)
b) ^=
[ \t]*([^ \t]+)(?:$|[ \t]+([^ \t]?.*?)$)I believe the latter (option b) would be correct. I would remove thefinal "[^ \t]?" and simplify it down to this: ^=
[ \t]*([^ \t]+)(?:$|[ \t]+(.*)$)
You don't really need regex though, just skip past the =
[whitespace],then the url is splitting on the first space and the remainder iseverything else.
~nytpu
-- Alex // nytpualex at nytpu.comgpg --locate-external-key alex at nytpu.com-------------- next part --------------A non-text attachment was scrubbed...Name: signature.ascType: application/pgp-signatureSize: 833 bytesDesc: not availableURL: <https://lists.orbitalfox.eu/archives/gemini/attachments/20211108/0bd99463/attachment.sig>