I'm trying to figure out how to find a string in PHP then delete all cocurrent letters after that string has been found until an eventual space.
Essentially in my app, I have a big text mixed with everything. For my outputs I want to remove any words that BEGINS with the character '@'.
For example string:
This is a placeholder #string and it looks @great right?
How do I search this string and remove only the "@great" part? I will not know what the @xxx would be so I first need to search the string then replace it with nothing.
I understand I can do this:
<?php
$string = "This is a placeholder #string and it looks @great right?";
$newstring = str_replace("@great", "", $string);
print $newstring;
?>
But I will not know what the @xxx will contain or how long it will be. What I would know is there will be an eventual break/space and thats all I want to remove.
So if the text contains a "@", find it along with all cocurrent letters until a space then remove the "@xxx" until the space. Leave everything else in tact.
Any ideas?