Closed ukgenes closed 3 months ago
Wouldn't it be better to provide a readable name, like "{:Url}" or "{:url} instead of "{:u}" ?!?
NOTE THAT: You can already use that by registering your own type. You just need to figure out what the regex pattern should look like.
Here's how you would do that yourself:
from parse import parse, with_pattern
regex_url = r"https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)"
@with_pattern(regex_url, regex_group_count=1)
def url(url):
return url
parse("{:url}", "http://www.hello-world.com", dict(url=url)))
{:u} to detect http[s}://kjjhh.com/asdhfk/sdfh/adsf?dsf=jkk
Great library!!!