cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ramanan89
Helper III
Helper III

URL Validation

Hi,

I am using this code for validating link in the form

 

    !IsMatch(DataCardValue2.Text, "(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$")

 

also tried

 

"(([\w]+:)?//)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,63}(:[\d]+)?(/([-//+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?"
//)

 

 

But its not validating the SharePoint and Teams link like below,

 

https://name.sharepoint.com/sites/filename/_layouts/15/Doc.aspx?OR=teams&action=edit&sourcedoc={38B53388-9C2E-4D09-964A-813B747F455A}

 

 and

 

https://teams.microsoft.com/l/file/38B54543-9C0E-4D09-964A-813B737F475A?tenantId=258ac4e4-146a-411e-9dc8-79a9e12fd6da&fileType=pptx&objectUrl=https%3A%2F%2Fname.sharepoint.com%2Fsites%2filenamefilenamefilenamefilenamefilenamefilenamefilenamefilename.pptx&baseUrl=https%3A%2F%2Fname.sharepoint.com%2Fsites%2filename-filename&serviceName=teams&threadId=19:5f2346fc521142ccbb22d38d1edeca68@thread.tacv2&groupId=183435fddb-7ef6-7587-a107-6ecbe64353e5

 

 

It says invalid link, anyway to fix this.

Thanks,

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @ramanan89 :

Please try this code:

 

IsMatch(DataCardValue2.Text, "(?:http(s):\/\/)[\w.-]+(?:\.[\w.-]+)+[\w\-\.,@?^=%&:/~\+#\{\}]*")

 

 Best Regards,

Bof

View solution in original post

2 REPLIES 2
v-bofeng-msft
Community Support
Community Support

Hi @ramanan89 :

Please try this code:

 

IsMatch(DataCardValue2.Text, "(?:http(s):\/\/)[\w.-]+(?:\.[\w.-]+)+[\w\-\.,@?^=%&:/~\+#\{\}]*")

 

 Best Regards,

Bof

View solution in original post

This Works... Thank you so much 🙂

I wonder for the Hyperlink in columns list, max character limit is 255 in SharePoint. But for the share link in Teams itself is more than 255 characters.. 😄

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (2,900)