Hi@Future_Vision,
I want to explain to you that the "www" is a domain name, you could not force a second dot to be added followed by the characters that is just followed by the "www."
So if you expect that there is a "www," and there must be a second dot followed by at least 2 characters, I am afraid that there is no way to achieve this using the regular expression.
From now on, we could only make the URL validation valid as below:
http(s)?:\/\/(www\.)?[a-zA-Z0-9][-a-zA-Z0-9]{0,62}\.([a-zA-Z0-9][-a-zA-Z0-9]{1,62})+
This would make the URL start with the http:// or https://. And if there is a "www." occurs, once you enter the second dot, you should enter at least 2 characters.
//From here on out is where I re-edit.
I've rethought it again, taking into account your needs. To achieve your needs, I think we only need to use a portion of the regular expressions and the next part needs to be combined with the relevant functions of PowerApps.
I don't think use the Require property to valid the URL is a good choice, use notification when you submit the form is much more efficient.
Please set the OnSelect property of the submit button as below:
If(
"www." exactin TextInput3.Text,
If(
CountRows(
Split(
TextInput3.Text,
"."
)
) >= 3 && Len(
Last(
Split(
TextInput3.Text,
"."
)
).Result
) >= 2 && IsMatch(
TextInput3.Text,
"http(s)?:\/\/(www\.)?\S*"
),
SubmitForm(Form1),
Notify(
"Invalid URL!",
NotificationType.Error
)
),
If(
IsMatch(
TextInput3.Text,
"http(s)?:\/\/(www\.)?\S*"
),
SubmitForm(Form1),
Notify(
"Invalid URL!",
NotificationType.Error
)
)
)
Note: Anytime the user enter an invalid URL, the form could not be submitted.
Here is the original formula that validate the URL:
If(
"www." exactin TextInput3.Text,
CountRows(
Split(
TextInput3.Text,
"."
)
) >= 3 && Len(
Last(
Split(
TextInput3.Text,
"."
)
).Result
) >= 2 && IsMatch(
TextInput3.Text,
"http(s)?:\/\/(www\.)?\S*"
),
IsMatch(
TextInput3.Text,
"http(s)?:\/\/(www\.)?\S*"
)
)
Regards,
Qi