File

projects/wms-framework/src/lib/baseframework/Regex/RegexHelper.ts

Description

Class representing the Regex object.

Index

Methods

Methods

Static isMatch
isMatch(target: string, expression: string, option: RegexOptions)

Match the current expression on the target.

Parameters :
Name Type Optional Default value Description
target string No

The target to be evaluated.

expression string No

The regular expression.

option RegexOptions No RegexOptions.None

The option.

Returns : boolean

A new instance of match.

Static match
match(target: string, expression: string, option: RegexOptions)

Creates a new instance of match.

Parameters :
Name Type Optional Default value Description
target string No

The target to be evaluated.

expression string No

The regular expression.

option RegexOptions No RegexOptions.None

The option.

Returns : Match

A new instance of match.

import { Match } from './Match';
import { RegexOptions } from './RegexOptions';

/**
 * Class representing the Regex object.
 */
export class RegexHelper {
  /**
   * Creates a new instance of match.
   * @param target The target to be evaluated.
   * @param expression The regular expression.
   * @param option The option.
   * @returns A new instance of match.
   */
  public static match(
    target: string,
    expression: string,
    option: RegexOptions = RegexOptions.None
  ): Match {
    return new Match(expression, target, option);
  }
  /**
   * Match the current expression on the target.
   * @param target The target to be evaluated.
   * @param expression The regular expression.
   * @param option The option.
   * @returns A new instance of match.
   */
  public static isMatch(
    target: string,
    expression: string,
    option: RegexOptions = RegexOptions.None
  ): boolean {
    return new Match(expression, target, option).success();
  }
}

result-matching ""

    No results matching ""