Reputation: 2413
In a Jasmine test, I am trying to set this match to fit with expressions like:
'Request <any_word>
for <any_word>
- Open actions menu'.
However, it's not being possible with this line, but Javascript doc says that \\w
is the regex for any word:
expect(item.getIconToolTip()).toMatch('Request \\w for \\w - Open actions menu');
Any hint?
Upvotes: 0
Views: 126
Reputation: 174706
Use +
to repeat the previous token one or more times. \\w
alone will match a single word character only.
expect(item.getIconToolTip()).toMatch('Request \\w+ for \\w+ - Open actions menu');
Upvotes: 3
Reputation: 413717
The special sequence \w
matches any single word character, not whole words. You could use \b\w+\b
to match a word, but defining exactly what a "word" is will be something you'll have to work out for your own purposes.
Upvotes: 3