I want to check whether a regex field is empty or not and depending on that I want to execute a function. the input field is a regex field and by default it stores "//" value in the field and I dont want to execute a function if the value contains "//". Only when user enters some value I would wnat to execute the function.
new shared.form.RegexField({
ref : 'regexField',
fieldLabel : 'Regular Expression',
allowBlank : false,
width : 300,
});
Ex:
var rule = "//";
if(rule) {
// dont do anything;
}
however if rule contains some value like:
rule = "/test/";
if(rule) {
// call API sevrice.
}
is this possible?
if (rule.match("/\/\//")) {
// don't call because it's equal to "//"
} else {
// call API service
}
var rule = '//www.example.com'
if(rule.replace(/(\/\/)(?=(\S)*)/,'')){
// call API sevrice.
}else {
// dont do anything;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.