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

11g to 12c OSB projects migration points

1. Export 11g OSB code and import in 12c Jdeveloper. Steps to import OSB project in Jdeveloper:   File⇾Import⇾Service Bus Resources⇾ Se...