You need a regular expression that will search for everything that starts with / and ends with numbers. Wrote this option, but it does not work:
/ ^ / $ [0-9] + /
You need a regular expression that will search for everything that starts with / and ends with numbers. Wrote this option, but it does not work:
/ ^ / $ [0-9] + /
here is my version ^\/+.+[0-9]+$
. ^\/+.+[0-9]+$
. you can check here
if the desired value in the text, you can use this option \/+.+[0-9]
$re = "/\/+.+[0-9]/"; $str = "sadsadas/dfsdf222dfsdfsf7131s2dasdsadasdasda\n"; preg_match($re, $str, $matches);
We /dfsdf222dfsdfsf7131s2
: /dfsdf222dfsdfsf7131s2
Source: https://ru.stackoverflow.com/questions/509277/
All Articles
/
in the regular form, something like this:/^\/[0-9]+/$
. Only select lines/123
, but not/asd123
. If you need the latter, then/^\/.*[0-9]+/$
- BOPOH$
is the end of the line, and it should be inside the regular schedule, i.e. inside/.../
, i.e. should have been like this:/^\/.*[0-9]+$/
. I have designed the examples by reference, i.e. you could just watch and try the work of the regular online - BOPOH^
and$
. And how to choose? For example, there is the text/asd123/dsa123asd321
- what should be the result? heap options: whole line, only/asd123
and/dsa123
(or/dsa123asd321
) or only/dsa123
or something else - BOPOH