开发者

How do I convert the following expression from POSIX to PCRE? [duplicate]

开发者 https://www.devze.com 2023-02-25 15:42 出处:网络
This question already has answers here: How can I convert ereg expressions to preg in PHP? (4 answers) Closed 3 years ago.
This question already has answers here: How can I convert ereg expressions to preg in PHP? (4 answers) Closed 3 years ago.

I wish there was a simple utility that would do this, as regular expressions scare me. I'd like to update the following to preg_replace() if anyone could explain to me how.

eregi_replace('([a开发者_开发百科-zA-Z0-9_]{'.$min_char.','.$max_char.'})','', $password)

Thanks for any help.


Should be just

/([a-zA-Z0-9_]{$min_char,$max_char})/

preg_replace('/([a-zA-Z0-9_]{'.$min_char.','.$max_char.'})/','', $password)

As far as I can see only the delimiter are missing.

0

精彩评论

暂无评论...
验证码 换一张
取 消