# RegExp

`import { RegExp } from "destack:regexp";`

Regular expression pattern.

```ds title="RegExp"
export class RegExp {
    lastIndex: float64;
    static escape(text: string): ^string;
    get source(): Cow<"frame", string>;
    get flags(): Cow<"frame", string>;
    get hasIndices(): boolean;
    get global(): boolean;
    get ignoreCase(): boolean;
    get multiline(): boolean;
    get dotAll(): boolean;
    get unicode(): boolean;
    get unicodeSets(): boolean;
    get sticky(): boolean;
    constructor(pattern: string | RegExp, flags?: string | undefined);
    exec(input: string): RegExpMatch | null;
    test(input: string): boolean;
    toString(): Cow<"frame", string>;
}
```

[language/library/src/regexp/regexp.ds:58:136](https://github.com/destack-sh/destack/blob/main/language/library/src/regexp/regexp.ds#L58-L136)

## Members

### `lastIndex: float64`

The next UTF-16 index used by global and sticky matching.

### `static escape(text: string): ^string`

Escape text so it can be used as a literal regular expression pattern.

### `get source(): Cow<"frame", string>`

The source pattern.

### `get flags(): Cow<"frame", string>`

The flags used to compile the pattern.

### `get hasIndices(): boolean`

Whether the `d` flag is set.

### `get global(): boolean`

Whether the `g` flag is set.

### `get ignoreCase(): boolean`

Whether the `i` flag is set.

### `get multiline(): boolean`

Whether the `m` flag is set.

### `get dotAll(): boolean`

Whether the `s` flag is set.

### `get unicode(): boolean`

Whether the `u` flag is set.

### `get unicodeSets(): boolean`

Whether the `v` flag is set.

### `get sticky(): boolean`

Whether the `y` flag is set.

### `constructor(pattern: string | RegExp, flags?: string | undefined)`

Create a regular expression.

### `exec(input: string): RegExpMatch | null`

Execute the pattern against `input`.

### `test(input: string): boolean`

Return whether the pattern matches `input`.

### `toString(): Cow<"frame", string>`

Return the literal regular expression spelling.
