Again i am back with a quick post, I had the validate the following scenario,
I needs to put the validation, “if the URL is entered then only check the URL is valid”.
- Edit form bind to SharePoint List
- A HyperLink SharePoint Value bind to the DataCard.
I have achieve this by doing the following steps
- Validate the URL with Regex, if the URL is filled. So in the “Required” Field for DataCard put the following text
If(!IsBlank(DataCardValue5.Text) && !IsMatch(DataCardValue5.Text, “(?:http(s)?:\/\/)?[\w.-]+(?:.[\w.-]+)+[\w-._~:/?#[]@!\$&'()*+,;=.]”),true,false)

- Error Message if not Valid. Put the Following text in ErrorMessage field “Text” property
If(!IsBlank(DataCardValue5.Text) && IsMatch(DataCardValue5.Text, “(?:http(s)?:\/\/)?[\w.-]+(?:.[\w.-]+)+[\w-._~:/?#[]@!\$&'()*+,;=.]”),””,””)

You can see the result in following gif

Check out the following url
https://thatapiguy.tech/2019/09/18/validate-a-url-in-powerapps/, well written quick tip.