Thursday, May 27, 2021

OIC- Javascript - return count of string using Regular expression

 Js code: returnCountOfString.js

function returnCountOfString(value,string){

var rgxp = new RegExp(string,"g")

var output = (value.match(rgxp)||[]).length;

return output

}


or 

function returnCountOfString(value,string){

var rgxp = new RegExp(string,"g")

var output = value.match(rgxp).length;

return output

}



No comments:

Post a Comment

Featured Post

OIC - how can I use XSLT functions to remove leading zeros from numeric and alphanumeric fields?

To remove leading zeros from an numeric field in Oracle Integration Cloud (OIC) using XSLT, you can Use number() Function The number() funct...