function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Bhaswanthnaga vivek vutukuriBhaswanthnaga vivek vutukuri 

URL format validation


Can anyone please help me in validating URL format ?

I used the following Regular expression but it is working good, its showing even valid URL's as Invalid 


Grazitti TeamGrazitti Team

Use the following regular expression to validate URL format: -

And don't forget to mark this answer as best, if answer this helps you :-)

Grazitti Team

Bhaswanthnaga vivek vutukuriBhaswanthnaga vivek vutukuri
Hi grazitti team,
I am getting Syntax error when i used your regular expression :(
Grazitti TeamGrazitti Team

Can you please try the "jquery validate" to valiadte the Url format?

Please see the below link and code for refrence:

VisualForce Page:
<apex:form id="formId">
     <script type="text/javascript">
			url: true
	<apex:outputlabel for="url">UrlTovalidate</apex:outputlabel></span>
	<apex:inputText label="" value="test" id="url"/>

Please mark as best answer if it solves your problem.

Grazitti Team,
Bhaswanthnaga vivek vutukuriBhaswanthnaga vivek vutukuri

Hey hi,
I need to write for some field in an Sobject ,
I tried in NOT(REGEX(url,^((http|https)://)??(www[.])??([a-zA-Z0-9]|-)+?([.][a-zA-Z0-9(-|/|=|?)??]+?)+?$)) but no use...
Now I used IF() it is working now

thnks for reply