A text comes into the variable that can contain 2 or more consecutive @ characters.
Example 1:
It is necessary to delete it if there are two or more @ symbols in the text in a row.
For example, the text contains:
- 2 @ 2 - do not touch.
- and if like this @@ - remove both characters.
It is necessary to delete all the characters in the string that contains two or more dogs in a row, or one dog after which there is no symbol.
But the text may contain two examples at once and it is important that the text from the first example remain unharmed.
Example 2:
Such an option is possible: if there are characters in the line before and after the dog that are not spaces, delete everything else.
Options that need to be removed:
- r @;
- @;
- @r;
- @@@@@@@;
Who already did tell me how to solve?
/@@+/(i.e.,preg_replace('/@@+/', '', '@ @@ @@@ @a@')) - BOPOH@d@also replaced? or only when characters go in a row? - Grundy(preg_replace('/@@+|@(?=(\s|\r|\n|$))/', '', '@a @ @@ @@@@@ @a@')(at the output we get "@a @a" ). And if you delete if there is nothing in front of the dog, then this is:preg_replace('/@@+|@(?=\s|$|\r|\n)|(?<=\s|^|\r|\n)@/', '', '@aa@a @a @ @@ @@@@@ @a@')(output "aa @ aa a " ) - BOPOH