The following word can be an entry:
1200
90
Ashton
Created By
Johnson & Johnson
Lemon Pie
Xavier
I have the following RegEx:
var rexp = new RegExp('^' + val, 'i');
I am entering the following:
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.
How can I modify the RegExp() function, so it takes space into account to find a match, so:
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`.