I want to replace all elements of a string starting with a dollar sign. Here you can find my example:
my_string <- "$AAPL $TSLA I recomend to buy $TLSA and to sell $AAPL; the price is rising to $12.56"
The replacement is the word "cashtag".
Here is my desired output:
my_string
"cashtag cashtag I recomend to buy cashtag and to sell cashtag; the price is rising to $12.56"
I already tried it with str_replace_all and startsWith.
But so far I have not come to a solution.
I would also be very happy about a suggested solution using the tidyverse package.