Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
您能否指出一个仅匹配字符串的第一个字母的 PCRE RegEx。我需要传递给 Mongo DB,我担心我正在使用^a.
^a
例子:
匹配
苹果
鳄鱼
不匹配
谢谢
PCRE 中有特殊的标记来表示字符串的开头和结尾
/^a/ => will match all strings that start with "a"
您可以使用字符串anchor ^的开头。
^