CategorialRule

CategorialRule

new CategorialRule()

Categorial Rule abstracts a single matching rule

Source:

Members

(static) count :number

Number of items this transform is used

Source:
Type:
  • number

(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'
Source:
Type:
  • string

(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'

Source:
Type:
  • string

Methods

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

Match function

Source:
Parameters:
Name Type Description
text string

The text to match

Returns:
Type:
string | false

group The group label if matching, else false