Reputation: 8836
Hello if I have the following string
This seems to find the node... ok but the output is below
How can i remove ... and have it printed? I am using PHP
Thank you!
Upvotes: 2
Views: 85
Reputation: 25781
You should use str_replace:
$newString = str_replace('...', '', $string);
Using regexes for such simple tasks is just overkill and will hurt performance:
Avoid regexes in favor of str_replace() and strstr(). Don’t use regexes unless you really need them. The string functions are much faster.
Upvotes: 4
Reputation: 20173
Also, for simple $strings, you can use
$new_string = str_replace('find','replace_with',$old_string);
To remove '...' using str_replace, simply:
$new_string = str_replace('...','',$old_string);
Upvotes: 2
Reputation: 29764
$new_str = preg_replace('/\.{3,}/', '' , $str);
$str
is the original string
Upvotes: 1