Ereg () for preg_match () how?

I have simple simple regular expressions that I use.

It is as simple as:

"user/" "user/[A-z0-9_-]" 

They all work fine with ereg, but not preg.

How to convert it?

thanks

+4
source share
2 answers

This is most likely because you do not have delimiters . Try the following:

 "~user/~" "~user/[A-z0-9_-]~" 
+7
source
 ereg('jpg$', $query) 

Included in:

 preg_match('@ jpg$@ ', $query) 
0
source

Source: https://habr.com/ru/post/1343211/


All Articles