Brian Dunning's FileMaker Custom Functions

ParseUrl ( _url )

Parse the URL and return the result as JSON.

  Be the first to rate this function Log in to vote

Teruhiro Komaki   Teruhiro Komaki - Show more from this author
frudens Inc.
https://frudens.jp

Share on Facebook Share on Twitter

  Sample input:
ParseUrl ( "https://username:password@bucket-demo.s3.us-east-1.amazonaws.com:80/path/to/file.txt?list-type=2&prefix=s3Prefix/a/b/#fragment" )
  Sample output:
{
"fileName" : "file.txt",
"fragment" : "fragment",
"host" : "bucket-demo.s3.us-east-1.amazonaws.com",
"password" : "password",
"path" : "/path/to/file.txt",
"port" : "80",
"query" : "list-type=2&prefix=s3Prefix/a/b/",
"scheme" : "https",
"urlIsEmpty" : true,
"userName" : "username"
}

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

Parse the URL and return the result as JSON.

- If urlIsEmpty is 'false', the URL may have failed to parse.
- Please let me know if there is anything I have overlooked.
- For the structure of the URL, I referred to the URL below.
https://en.wikipedia.org/wiki/URL

 

Comments

João Coutinho   João Coutinho
Nov 24, 2022
Nice!!
 
Teruhiro Komaki   Teruhiro Komaki, frudens Inc.
Feb 24, 2023
It was fixed because it did not consider the case where "/" was included in the query.
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: