For example, there is a string
<?php $string = "#tag@footbal Последние новости прошедшего дня" ?> How can you save this line from tags in the future? Tags may be different, but they look the same: Grid and some text up to the first space.
How ca...">
Write a pattern that will match the substring beginning with the # character, followed by any characters except space. Well, the whitespace symbol is also captured, so that there are no extra spaces after deleting hash tags:
$string = "#tag@footbal Последние новости прошедшего дня"; $string = preg_replace('~#\S+\s+~', '', $string); echo $string; Source: https://ru.stackoverflow.com/questions/876460/
All Articles