简体   繁体   中英

Regex, one occurrence between two differents delimiters

I'd like to have a regex which select everything between the not-included characters delimiters ``` and I . I only want the first occurrence.

Here is my wrong try (very new to regex) :

(^`)[\s\S](I$)?
/(?<=`).*?(?=I)/s

This regex will look for a backtick, but not include it. Then it will match anything it can, up to the first I character.

The difference between this answer and @vks's answer is that mine will require there to be an ending delimiter.

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