简体   繁体   中英

Get all words between two delimiters with regex

I'm tring go get all words betwenn two delimiters.

Example:

|Test1|Test2|Test3|

\|(.*?)\|

But it gets only Test1 and Test3

https://regex101.com/r/b2xVxH/2

Use this regexpr

\|(.*?)(?=\|)

If your regex engine can look ahead use this one (?<=\\|)(.*?)(?=\\|)

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