Tukuna
Tukuna

Reputation: 457

Testing for regular expressions in coffescript rails

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

Answers (1)

orip
orip

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

Related Questions