Regex Helpers

Table of Contents

regex

Visit the: code | unit tests

{toRegex}

Convert the given string to a regular expression.

Params

  • str String
  • returns RegExp

Example

{{toRegex "foo"}}

{test}

Returns true if the given str matches the given regex. A regex can be passed on the context, or using the toRegex helper as a subexpression.

Params

  • str String
  • returns RegExp

Example

{{test "bar" (toRegex "foo")}}

{{test "foobar" (toRegex "foo")}}

{{test "foobar" (toRegex "^foo$")}}

Table of Contents