Need syntax for "matches regex"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2015 03:23 PM
Hello,
I'm trying to filter a database reference using the "matches regex" criteria. I can't figure out how to get this feature to work. I've tried enclosing my regular expressions in single quotes, double quotes, forward slashes, and so on, but nothing seems to work. I get an error message that says: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MATCH_RGX '([A-Z]{8})' at line 1.
I use regular expressions quite regularly (pardon the pun) in JavaScript, PHP, Ruby, etc. Each language has its own quirky rules, and I usually figure it out after a few minutes. But I admit, I'm completely stumped here. I even tried matching on a wild card like this: /.*/ but still, it keeps giving me the above error message. The only thing that doesn't seem to give an error message is to leave the field completely blank. Obviously, that doesn't do much good.
I've Googled and searched the forums, but I've found no definitive guidance on how to use this feature.
Thanks,
Dan
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2015 07:45 AM
Oh yeah, I blew a good 3-4 hours on it too. Maybe this will help though. We kind of got a work around that may be helpful (Eureka). We used this to only pull company names that are in all upper case.
Script Include:
Name: getNormalCompany
Client callable: true
var getNormalCompany = Class.create();
getNormalCompany.prototype = {
initialize: function () {
},
getNormalName: function () {
var answer = '';
//Get list of all companies
var compName = new GlideRecord('core_company');
compName.query();
//Itterate through companies
while (compName.next()) {
//check if all alpha characters are upperCase
if (compName.name == compName.name.toUpperCase()) {
//if uppercase, add to list
answer += (',' + compName.sys_id);
}
}
//return results
return 'sys_idIN' + answer;
}
};
On the Reference Variable:
Type Specifications >
Use reference qualifier: Advanced
Reference qual: javascript:new getNormalCompany().getNormalName()

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2018 09:12 PM
You've got to be kidding me this is still a thing. I'm running into the same issue. C'mon SN, if you put the option there, support/document it!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2024 03:51 PM
6 years past - issue remains