【发布时间】:2021-04-11 19:25:24
【问题描述】:
我需要匹配具有a-z、\? 或\* 的字符串,例如:
abcd
abc\?d # mush have a \ in front of a ?
abc\*d
ab\?c\*d
并排除在其他标点符号前没有\的字符串,例如
abc?d
abc*d
ab?c*d
我试过[a-z(?:\\\?)(?:\\\*)]+ (https://regex101.com/r/5yYBDl/1),但它不起作用,因为[] 只支持我猜的字符。
任何帮助将不胜感激。
【问题讨论】: