Answer the question
In order to leave comments, you need to log in
Regulator not working properly?
Wrote such a regular expression to separate the numbers from the text.
https://regex101.com/r/yBWKBd/1
on regex tester everything works correctly, it is divided into two groups, in one text in the other numbers.
in php sandbox code( sandbox.onlinephpfunctions.com ):
<?php
$re = '/([a-zA-Zа-яА-Я]+)([0-9]+)/';
$str = 'Сообщения21';
preg_match($re, $str, $matches);
var_dump($matches);
array(3) {
[0]=>
string(10) "ения21"
[1]=>
string(8) "ения"
[2]=>
string(2) "21"
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question