Skip to content

Need RegExp.flags #253

@jmagaram

Description

@jmagaram

I have a regular expression. I want to check if it starts with ^ and if not, create a new regular expression with ^ at the beginning. Like this...

  let patternMustStart = pattern => {
    let original = pattern->RegExp.source
    switch original->String.startsWith("^") {
      | true => pattern
      | false => RegExp.fromStringWithFlags("^"++original, ~flags=Js.Re.flags(pattern))
  }

The RegExp.flags function is missing. Must use Js.Re instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions