简体   繁体   中英

Converting a php regex to javascript

如何将以下php正则表达式转换为javascript正则表达式?

php regex:- (?s)(?<=<a).*?(?=<\/a>)

It's not possible to use the exact same pattern in javascript, because lookbehinds aren't supported.

The best I could do is

<a([^]*?)(?=<\/a>)

It should match the same text as the php regex, but captures the text in the first capture group instead.

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