以下单词可以是条目:
1200
90
Ashton
Created By
Johnson & Johnson
Lemon Pie
Xavier
我有以下RegEx
:
var rexp = new RegExp('^' + val, 'i');
我正在输入以下内容:
If I enter `12`, there is a match, `1200`.
If I enter `Lem`, there is a match, `Lemon Pie`.
If I enter `Lemon P`, there is no match.
If I enter `Johnson &`, there is no match.
If I enter `&`, there is no match.
如何修改RegExp()
功能,因此需要考虑空间才能找到匹配项,因此:
If I enter `12`, there is a match, `1200`.
If I enter `Lem`, there is a match, `Lemon Pie`.
If I enter `Lemon P`, there is a match, `Lemon Pie`.
If I enter `Johnson &`, there is a match, `Johnson & Johnson`.
If I enter `&`, there is a match, `Johnson & Johnson`.
答案 0 :(得分:2)