简体   繁体   中英

PHP equivalent of JavaScript regex

PHP equivalent of this JavaScript regex (?<=(\\s|^|,))(abc)(?=(\\s|,|$)).

This regex is for the exact match of abc.

https://regex101.com/r/pP3pN1/60

I tried but pattern error shows

You don't need () inside first and third group. /(?<=\\s|^|,)(abc)(?=\\s|,|$)/ would work in both PHP and JS.

PHP and JS demo.

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