$url (parse-spec) function
The URL word given by parse-spec is returned, where the URL portion must begin with http://, https:// or ftp:// delimited by a blank space. If the parse-spec value does not return a URL, the match specification is not matched. This function is especially useful in a nested specification. (See further section.)
Target string | Parse expression | Return value |
---|---|---|
URL: http://xxx.com/x/index.html | $url ($2) | http://xxx.com/x/index.html |
target: http://xxx.com/x/index.html | $url(target: *) | http://xxx.com/x/index.html |
The ftp site is: ftp://test.com | $url (is: *) | ftp://test.com |
The ftp site is: ftp://test.com:99 | $url (is: *) | ftp://test.com:99 |
GET https://x.y | $url (get *) | https://x.y |
Test 123 | $url ($2) | No match. The second word of the target string is not a URL. |
Test string AAA | $url ($4) | No match. There is no fourth word in the string. |
Test http://a.b.com value | $url (xxx: *) | No match. There is no match for XXX: * in the target string. |
Related topic