Regex code for three variables

J_31
Kilo Sage

Hi 

 

I have to validate three filed values to check the URL’s using regex 

 

all three fields should be validated for same below are the text field name 

 

developer : 

sandbox :

prod: 


I have a lengthy validation message so i can’t use out of the box regex I want to use Onchange client script 

can someone help with code ? 

 

 

4 REPLIES 4

Saurabh Gupta
Kilo Patron
Kilo Patron

What kind of validation you want to do with these variables?

 

 


Thanks and Regards,

Saurabh Gupta

Validate the field values contains “https://“ 

Hi @J_31 
Field value starts with or contain?

 

 


Thanks and Regards,

Saurabh Gupta

Prashant Ahire
Kilo Sage

@J_31 
You can use this regex code and modify according to your requirement.

// Function to validate if a string contains "https://"
function validateUrl(input) {
  // Define the regular expression
  var regex = /^https:\/\//;

  // Test the input against the regular expression
  return regex.test(input);
}

// Example usage:
var url1 = "https://www.example.com";
var url2 = "http://www.example.com";

console.log(validateUrl(url1)); // Output: true
console.log(validateUrl(url2)); // Output: false

 

Please check and Mark Correct and Helpful if it really helps you.
Regards,
Prashant Ahire