简体   繁体   中英

Regex to exclude URL with special configuration

I want to exclude a url with this configuration https://subdomain.example.com/y22la7hv from a string.

I'm trying to do this with the following regex but is not working: https://subdomain\.example\.com/([a-zA-Z]+([0-9]+[a-zA-Z]+)+)

Where am I failing?

Here it is after lot's of trying and error. Enjoy!

$str = 'https://subdomain.example.com/y22la7hv';
$pattern = '/https:\/\/subdomain\.example\.com\/([a-zA-Z]+([0-9]+[a-zA-Z]+)+)/i';
$exclude_rgx = preg_replace($pattern, '', $str);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM