Reputation: 33
I have the following input string:
"i'm good RT @someone : how are you?"
I want to remove everything after i'm good
for having a final string like below:
"i'm good"
Here the regex I had so far:
/ RT\s*@[^:]*:\s*[A-Za-z ]/
However, only ' RT @someone :' is removed, the status is still on.
What am I missing?
Upvotes: 1
Views: 982
Reputation: 67968
RT\s*@[^:]*:\s*[A-Za-z ]+
You need to add a quantifier like *
or +
to remove status as well.
or
RT\s*@[^:]*:\s*.*
Upvotes: 0