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.
我正在运行一个奇怪的 reg ex 问题。我正在尝试过滤以字符 A 或 a 开头的名称并使用 dataStore.filter("name", /^[Aa]*$/);
但由于某种原因,我得到了空店。
任何帮助表示赞赏
塔拉罕
你的正则表达式是错误的。您要求输入字符串的开头,后跟任意数量的字母 a,然后是字符串的结尾。唯一会匹配的是空字符串和字符串,如 A、a、Aa、aAAAaAaaaaAAAa 等。
尝试这个:
dataStore.filter('name',/^[Aa]/)