FGF-College-Work / Forum

:beer: Espaço dedicado a discussões e tira dúvida sobre disciplinas e conteúdo tecnológico.
MIT License
13 stars 4 forks source link

How to replace using regex in ionic/angular #196

Open marcialwushu opened 4 years ago

marcialwushu commented 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.

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