<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Is there a best practice to validating user input links?</title><link>https://community.appian.com/discussions/f/best-practices/11458/is-there-a-best-practice-to-validating-user-input-links</link><description>I have a text input field that once entered by the user we will be converting to an external hyperlink using the safeLink function. We are trying to figure how best to validate the contents of the text input field since safeLink doesnt work unless the</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Is there a best practice to validating user input links?</title><link>https://community.appian.com/thread/50453?ContentTypeID=1</link><pubDate>Wed, 29 Nov 2017 00:03:23 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3403b521-e07c-4d7e-8ccd-34027ec6d628</guid><dc:creator>ashokv</dc:creator><description>We have used some validations to define whether the URL is valid or not. &lt;br /&gt;
1. It should always start with http:// or https:// (in some cases you might also consider ftp://, but not sure if safelink URL functions works with this, never tested)&lt;br /&gt;
2. As per standard, URL cannot contain more than 2083 characters&lt;br /&gt;
3. It should have something after &amp;#39;http://&amp;#39; else the safelink URL will fail.&lt;br /&gt;
4. I also suggest that you consider that URL should not have any special characters like @#$!&amp;#96;^&amp;amp;*\&amp;lt;&amp;gt;?&amp;#39;{};,+=~&amp;quot;&amp;quot; else the safelink URL will fail.&lt;br /&gt;
&lt;br /&gt;
There might be some more validations that other practitioners have used. Lets see if they come up with some more.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is there a best practice to validating user input links?</title><link>https://community.appian.com/thread/50445?ContentTypeID=1</link><pubDate>Tue, 28 Nov 2017 22:47:44 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:18c6c3ca-ff66-4cc1-9e61-b1c10a30c525</guid><dc:creator>josep</dc:creator><description>If you just want to validate the http/httpsyou can think on something like this  &amp;quot;like function&amp;quot;&lt;br /&gt;
with(&lt;br /&gt;
  local!link:&amp;quot;&lt;a href="http://google.com&amp;quot;,"&gt;http://google.com&amp;quot;,&lt;/a&gt;&lt;br /&gt;
  or(&lt;br /&gt;
    like(local!link,&amp;quot;http://*&amp;quot;),&lt;br /&gt;
    like(local!link,&amp;quot;https://*&amp;quot;)&lt;br /&gt;
  )&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
But I agree with Jarrod and I prefer always to validate the input with regex because it works really well and has lot of power. &lt;br /&gt;
&lt;br /&gt;
I hope you don&amp;#39;t need the existence of the url and  i would suggest to add a field with the type of link (SharePoint, local repositories, etc.) based on it you will validate using different regex. This way you will be able to find the types. &lt;br /&gt;
&lt;br /&gt;
Best regards &lt;br /&gt;
Jose Perez&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is there a best practice to validating user input links?</title><link>https://community.appian.com/thread/50438?ContentTypeID=1</link><pubDate>Tue, 28 Nov 2017 20:50:23 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:63ba9f49-1e56-422c-ba38-9a81b973215a</guid><dc:creator>JarrodSharp</dc:creator><description>I&amp;#39;d suggest using a regular expression test to validate the input.  There are available functions in a shared component  &amp;quot;Appian Regular Expression&amp;quot; functions.    Then a quick search of the internet reveals a few URL regex patterns which might do the job, such as:&lt;br /&gt;
&lt;a href="https://www.regexpal.com/94502"&gt;https://www.regexpal.com/94502&lt;/a&gt; or &lt;br /&gt;
&lt;a href="https://stackoverflow.com/questions/161738/what-is-the-best-regular-expression-to-check-if-a-string-is-a-valid-url"&gt;stackoverflow.com/.../what-is-the-best-regular-expression-to-check-if-a-string-is-a-valid-url&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
These won&amp;#39;t be able to validate that the endpoint actually is live however&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>