$regex = /(^)(\[(.*)\]) (.*)$/;
Regex takes all chat messages of the form:
[Помощь] Джон: ...
The problem is that the chat also contains lines like:
[ ] Служебная информация: ... [ >Важно< ] ... [ >>> ] ... [ <<< ] ...
That is, in fact, I need to exclude lines where at the beginning between
- There are only spaces and / or signs
- There is only an inscription
важно, with spaces and signs
In this case, the space, the signs
< can be found in other cases, but if there are also other characters between
] , then such a string must be taken
[Общий] Джон: Привет [ > СТАТУС < ] ... [ >>> 45] ...
$regex = /^\[(?![\s<>]*\])(.*?)\] (.*)$/;