Regex code for three variables
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2023 07:49 PM
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 ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2023 09:32 PM
What kind of validation you want to do with these variables?
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2023 09:55 PM
Validate the field values contains “https://“
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2023 10:48 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2023 10:40 PM
@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