Reputation: 69
I'm trying to remove specific text from incoming value
changeable:# this can be changeable
global:# this is global
manager:# this is manager
what I want:
this can be changeable
this is global
this is manager
How can I remove it also the space after #
Upvotes: 0
Views: 67
Reputation: 37755
You can use replace method
^
- Start of string[^#]*
- Match anything except #
zero or more time#
- Match #
\s*
- Match space character zero or more timelet strArr = [`changeable:# this can be changeable`, `global:# this is global`, `manager:# this is manager`]
let textModifier = (str) => {
console.log(str.replace(/^[^#]*#\s*/, ''))
}
strArr.forEach(textModifier)
Upvotes: 1