How to validate regex expression in business rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2018 05:10 AM
Hi All,
I have a requirement to validate regex expression for below entries:
AAA00-00-000
1234567890
Please help.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2018 05:29 AM
Hi,
You can run javascript in business rule like below
var str = "this is test";
var patt = new RegExp("test");
var res = patt.test(str);
gs.print(res);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2018 05:35 AM
var exp = /(AAA00-00-000)/gm
var myString = "AAA00-00-000"
gs.log(exp.test());
You can run above code in background scripts . Same can be written in BR then !!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2018 05:48 AM
BOth didnt work for me in BR:
var isValid = false;
var project_code = current.variables.project_code;
if(current.variables.member_firm =='Australia')
{
var regexObj = new Regex("/^\(?([A-Z]{4}\d{3}-\d{2}-\d{2}-\d{2}-\d{4})$/");
if (regexObj.test(project_code))
isValid = true;
Always my result was false
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2023 06:03 AM
you able to came up with the solution , I am facing the same issue