In CoffeeScript how you can search a substring and how you can return either the starting position of the match or the matching value itself?
There are several methods for doing this using regular expressions. Some methods are called on a RegExppattern or object while some are called on String objects.
- RegExp objects: One way is to call the test method on a RegExp pattern or object. The test method returns a boolean value
- String objects: The match method matches the given string with the RegExp.