Open marcialwushu opened 4 years ago
To replace the back slash from the string using regex in ionic/angular:
let temp = “05/05/2019”
temp = temp.replace(/\//g,’ ‘);
console.log(temp) // “05052019”
replace() is used replace the particular char in the string.
replace()
It has two parameters replace(regex, to be replaced as)
char that has to be replaced should be given as second parameter and first parameter is the regex.
global command for regex is “//g” in which the replace char is given with the prefix of forward slash() to specify the replacement char.
“//g”
REGEX IN IONIC ANGULAR
To replace the back slash from the string using regex in ionic/angular:
let temp = “05/05/2019”
temp = temp.replace(/\//g,’ ‘);
console.log(temp) // “05052019”
replace()
is used replace the particular char in the string.It has two parameters replace(regex, to be replaced as)
char that has to be replaced should be given as second parameter and first parameter is the regex.
global command for regex is
“//g”
in which the replace char is given with the prefix of forward slash() to specify the replacement char.REGEX IN IONIC ANGULAR