我尝试了几个其他链接,如Regex Match all characters between two strings和Regex get all content between two characters 但它们似乎不符合此用例。正则表达式匹配2个字符之间的所有字符串
我想得到所有的名字,土豆和番茄。例如,从|
到>
。
text = "with <@U0D08NR3|potato> and <@U1698M96|tomato> please"
text.scan((?<=|).*?(?=>))
似乎没有工作,要么..
请指引我的正则表达式的神。
['<@ [A-Z0-9] {8} \ |(。*?)>'](https://regex101.com/r/X8PQ3P/1) – Tushar