如何使用正则表达式进行排序?
How to order using regular expressions?
/(summer camp)|(summer)|(camp)/
Forest camp
summer ramadan
summer camp
summer rakatun
我有关于link"summer camp"、"summer"、"camp"的测试数据,我需要做一个正则表达式,让"summer camp"成为第一场比赛
regexp 有匹配的搜索顺序,我需要第一个匹配来找到夏令营,尽管它在列表中排在第三位。但是现在第一个 "camp" 匹配。
regexp has a search order of matches, I need the first match to find a summer camp, despite the fact that it is third on the list. But now the first "camp" match.
不确定你的意思,但如果你想在优先级中找到这些
先找到夏令营的序列,就是这样
(?s)(summer camp)(?:.+?(summer|camp)?)?
/(summer camp)|(summer)|(camp)/
Forest camp
summer ramadan
summer camp
summer rakatun
我有关于link"summer camp"、"summer"、"camp"的测试数据,我需要做一个正则表达式,让"summer camp"成为第一场比赛
regexp 有匹配的搜索顺序,我需要第一个匹配来找到夏令营,尽管它在列表中排在第三位。但是现在第一个 "camp" 匹配。
regexp has a search order of matches, I need the first match to find a summer camp, despite the fact that it is third on the list. But now the first "camp" match.
不确定你的意思,但如果你想在优先级中找到这些
先找到夏令营的序列,就是这样
(?s)(summer camp)(?:.+?(summer|camp)?)?