Class: VerEx

VerEx

new VerEx() → {RegExp}

I am the constructor function.
Source:
Returns:
A new instance of RegExp with injected methods
Type
RegExp

Members

(static) prototype

Define the class methods.
Source:

Methods

(static) injectClassMethods(verbalExpression) → {RegExp}

Parameters:
Name Type Description
verbalExpression RegExp An instance of RegExp on which to add VerbalExpressions methods
Source:
Returns:
A new instance of RegExp with injected methods
Type
RegExp

add(value) → {VerbalExpression}

Function to add stuff to the expression. Also compiles the new expression so it's ready to be used.
Parameters:
Name Type Description
value string literal expression, not sanitized
Source:
Returns:
Freshly recompiled instance of VerbalExpression
Type
VerbalExpression

addModifier(modifier) → {VerbalExpression}

Modifier abstraction
Parameters:
Name Type Description
modifier String modifier to add
Source:
Returns:
Same instance of VerbalExpression to allow method chaining
Type
VerbalExpression

any(value) → {VerbalExpression}

Shorthand
Parameters:
Name Type Description
value String value to find
Source:
Returns:
Same instance of VerbalExpression to allow method chaining
Type
VerbalExpression

anyOf(value) → {VerbalExpression}

Any given character
Parameters:
Name Type Description
value String value to find
Source:
Returns:
Same instance of VerbalExpression to allow method chaining
Type
VerbalExpression

anything(value) → {VerbalExpression}

Any character any number of times
Parameters:
Name Type Description
value String value to find
Source:
Returns:
Same instance of VerbalExpression to allow method chaining
Type
VerbalExpression

anythingBut(value) → {VerbalExpression}

Anything but these characters
Parameters:
Name Type Description
value String value to find
Source:
Returns:
Same instance of VerbalExpression to allow method chaining
Type
VerbalExpression

beginCapture() → {VerbalExpression}

Starts a capturing group
Source:
Returns:
Same instance of VerbalExpression to allow method chaining
Type
VerbalExpression

br() → {VerbalExpression}

And a shorthand for html-minded
Source:
Returns:
Same instance of VerbalExpression to allow method chaining
Type
VerbalExpression

digit() → {VerbalExpression}

Any digit
Source:
Returns:
Same instance of VerbalExpression to allow method chaining
Type
VerbalExpression

endCapture() → {VerbalExpression}

Ends a capturing group
Source:
Returns:
Same instance of VerbalExpression to allow method chaining
Type
VerbalExpression

endOfLine(enable) → {VerbalExpression}

Control end-of-line matching
Parameters:
Name Type Description
enable Boolean Control end-of-line matching
Source:
Returns:
Same instance of VerbalExpression to allow method chaining
Type
VerbalExpression

find(value) → {VerbalExpression}

And because we can't start with "then" function, we create an alias to be used as the first function of the chain.
Parameters:
Name Type Description
value String value to find
Source:
Returns:
Same instance of VerbalExpression to allow method chaining
Type
VerbalExpression

lineBreak() → {VerbalExpression}

Line break
Source:
Returns:
Same instance of VerbalExpression to allow method chaining
Type
VerbalExpression

multiple(value) → {VerbalExpression}

Matches the value zero or more times
Parameters:
Name Type Description
value String value to find
Source:
Returns:
Same instance of VerbalExpression to allow method chaining
Type
VerbalExpression

oneOrMore() → {VerbalExpression}

Repeats the previous at least once
Source:
Returns:
Same instance of VerbalExpression to allow method chaining
Type
VerbalExpression

or(value) → {VerbalExpression}

Adds alternative expressions
Parameters:
Name Type Description
value String value to find
Source:
Returns:
Same instance of VerbalExpression to allow method chaining
Type
VerbalExpression

range() → {VerbalExpression}

Usage: .range( from, to [, from, to ... ] )
Source:
Returns:
Same instance of VerbalExpression to allow method chaining
Type
VerbalExpression

removeModifier(modifier) → {VerbalExpression}

Remove modifier
Parameters:
Name Type Description
modifier String modifier to remove
Source:
Returns:
Same instance of VerbalExpression to allow method chaining
Type
VerbalExpression

repeatPrevious() → {VerbalExpression}

Repeats the previous item exactly n times or between n and m times.
Source:
Returns:
Same instance of VerbalExpression to allow method chaining
Type
VerbalExpression

replace(source, value) → {VerbalExpression}

Shorthand function for the String.replace function to give more logical flow if, for example, we're doing multiple replacements on one regexp.
Parameters:
Name Type Description
source String string to search for
value String value to replace with
Source:
Returns:
Same instance of VerbalExpression to allow method chaining
Type
VerbalExpression

sanitize(value) → {String}

Sanitation function for adding anything safely to the expression
Parameters:
Name Type Description
value String string to sanitize
Source:
Returns:
sanitized value
Type
String

searchOneLine(enable) → {VerbalExpression}

Multiline, also reversed
Parameters:
Name Type Description
enable Boolean Control multi-line matching
Source:
Returns:
Same instance of VerbalExpression to allow method chaining
Type
VerbalExpression

something() → {VerbalExpression}

Any character at least one time
Source:
Returns:
Same instance of VerbalExpression to allow method chaining
Type
VerbalExpression

somethingBut(value) → {VerbalExpression}

Any character at least one time except for these characters
Parameters:
Name Type Description
value String value to find
Source:
Returns:
Same instance of VerbalExpression to allow method chaining
Type
VerbalExpression

startOfLine(enable) → {VerbalExpression}

Control start-of-line matching
Parameters:
Name Type Description
enable Boolean Control start-of-line matching
Source:
Returns:
Same instance of VerbalExpression to allow method chaining
Type
VerbalExpression

stopAtFirst(enable) → {VerbalExpression}

Default behaviour is with "g" modifier, so we can turn this another way around than other modifiers
Parameters:
Name Type Description
enable Boolean Control global matching
Source:
Returns:
Same instance of VerbalExpression to allow method chaining
Type
VerbalExpression

tab() → {VerbalExpression}

Tab (duh?)
Source:
Returns:
Same instance of VerbalExpression to allow method chaining
Type
VerbalExpression

then(value) → {VerbalExpression}

We try to keep the syntax as user-friendly as possible. So we can use the "normal" behaviour to split the "sentences" naturally.
Parameters:
Name Type Description
value String value to find
Source:
Returns:
Same instance of VerbalExpression to allow method chaining
Type
VerbalExpression

toRegExp() → {RegExp}

Convert to RegExp object
Source:
Returns:
Converted RegExp instance
Type
RegExp

whitespace() → {VerbalExpression}

Any whitespace
Source:
Returns:
Same instance of VerbalExpression to allow method chaining
Type
VerbalExpression

withAnyCase(enable) → {VerbalExpression}

Case-insensitivity modifier
Parameters:
Name Type Description
enable Boolean Control case-insensitive matching
Source:
Returns:
Same instance of VerbalExpression to allow method chaining
Type
VerbalExpression

word() → {VerbalExpression}

Any alphanumeric
Source:
Returns:
Same instance of VerbalExpression to allow method chaining
Type
VerbalExpression