CategorialRule

CategorialRule

new CategorialRule()

Categorial Rule abstracts a single matching rule

Source:

Members

(static) count :number

Number of items this transform is used

Type:
  • number
Source:

(static) expression :string

string or string format of regexp to match data against. To use a regular expression, start and end the string with a slash, '/'. Options can be appedended, notably 'i' for case insensitive matching. The first captured group can be used in the group, see below. Examples

  1. 'hello' matches 'hello', not 'hello world'
  2. '/hello/' matches 'hello world', but not 'Hello world'
  3. '/hello/i' matches 'I say Hello'
Type:
  • string
Source:

(static) group :string

Name of the group this is mapped to. The special substring $1 is replaced by the first captured group, in example 4 above, with group set to 'He says $1', the match results in 'He says goodbye'

Type:
  • string
Source:

Methods

(static) match(text) → {string|false}

Match function

Parameters:
Name Type Description
text string

The text to match

Source:
Returns:

group The group label if matching, else false

Type
string | false