I would like to keep one part of a sentence to put it in the arg of a function like this :
var sen1 = "Hello this is my email"
var final = "this is my email"
I'm a begginer with Node.js and JS in general. I've heard about the function RegExp but i don't know how to use it to remove the Hello
from the sen1
.
Can anyone help me or suggest me ideas to do it ?
You don't need RegEx for this, you can simply use the String method replace()
for this.
The syntax is as follows:
"".replace(<What you want to replace>, <by what you want to replace it>)
So you are looking for this:
let sen1 = "Hello this is my email"
let final = sen1.replace("Hello ", "");
console.log(final);