Reputation: 457
How can I test for existence of a pattern using coffee script. I am checking the data sent from server.
Currently I am using /false/.test(data), where data is, output data from server.
It is'nt working.
Any help is appreciated.
Upvotes: 0
Views: 705
Reputation: 75427
Look for JS regular expression docs, such as Mozilla's regular expression guide.
Coffeescript example:
console.log "found" if (data.search /regexpattern/) >= 0
Upvotes: 1