web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How do I validate a fi...
Power Apps
Suggested Answer

How do I validate a field to check if a URL starts with a 'https://' or 'http://' ?

(0) ShareShare
ReportReport
Posted on by 831 Moderator
I have a field set up for a URL. I want to make sure the user enters 'http://' or 'https://' at the beginning of the URL. If not I want an error message to show, I've tried this but for some reason it only work is only 'http://' or 'https://' is entered. Anything after that it fails. What am I missing?
 
If(!IsMatch(TXT_BaseURL.Text,"^https?://.+"),Notify("Invalid URL: URL should start with 'https://' or 'http://'",NotificationType.Error))
 
Categories:
I have the same question (0)
  • Suggested answer
    ronaldwalcott Profile Picture
    3,847 Super User 2025 Season 2 on at
    Did you try using MatchOptions.BeginsWith
     
    If(!IsMatch(TXT_BaseURL.Text,"^https?://.+",MatchOptions.BeginsWith),Notify("Invalid URL: URL should start with 'https://' or 'http://'",NotificationType.Error))
     
     
  • Mark Nanneman Profile Picture
    991 Super User 2025 Season 2 on at
    Another option is to preload the field with "https://" in the value property, or you could just auto-fix it for the user whenever the data has to be submitted.  If you were just saving the input to a variable, you could do it like this:

    If(
        !StartsWith(Lower(txt_url.Value),"https://") And !StartsWith(Lower(txt_url.Value),"http://"),
        Set(varUrlInput, $"https://{txt_url.Value}"),
        Set(varUrlInput, txt_url.Value)
    )




Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard