I am trying to check if a string is a valid deep link from Waze Live Map. A Waze Live Map deep link looks something like this:
https://www.waze.com/ul?place=ChIJj61dQgK6j4AR4GeTYWZsKWw&ll=37.42199990%2C-122.08405750&navigate=yes
Given a string, I want to know if it is a valid Waze live map link. Most important, I want to know if it has the longitude and latitude at least.
I have tried the following:
String str = 'https://www.waze.com/ul?place=ChIJj61dQgK6j4AR4GeTYWZsKWw&ll=37.42199990%2C-122.08405750&navigate=yes';
var wazeUrlPattern = r"https:\/\/www.waze.com\/ul\?ll\=(.)*([1-9]+\.[1-9]+)%2C([1-9]+\.[1-9]+)(.)?";
bool valid = new RegExp(wazeUrlPattern, caseSensitive:false).hasMatch(str);
if(!valid) {
print("The url is not valid waze live map link!");
return;
}
// Do something with the longitude and latitude and maybe other parameters
This is not working for me and I would like some help in figuring out the problem.