Reputation: 119
I am requesting assistance with a regular expression to show that there are at least 3 carets in a string. I've tried using /\^/
but that only finds if the caret exists one time.
Example Data:
KEYWORD^HOSTNAME^MESSAGE^NUMBERS
Upvotes: 1
Views: 79
Reputation: 5260
This expression should work:
(.*\^.*){3}
Example in javascript:
var str = "KEYWORD^HOSTNAME^MESSAGE^NUMBERS";
var patt = new RegExp(/(.*\^.*){3}/);
var res = patt.test(str);
console.log(res);
Upvotes: 2