Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding case flag to regexToString #91

Closed
wants to merge 1 commit into from

Conversation

Bidek56
Copy link
Collaborator

@Bidek56 Bidek56 commented Aug 8, 2023

Adding case flag to regexToString to address issue 82

@universalmind303
Copy link
Collaborator

lol, I was actually just about to open up a PR for this. I think we can push down most flags to rust (with a few exceptions).

export const regexToString = (r: string | RegExp): string => {
  if (isRegExp(r)) {
    if (r.flags.includes("g")) {
      throw new Error("global flag is not supported");
    }
    if (r.flags.includes("y")) {
      throw new Error("sticky flag is not supported");
    }
    return r.flags ? `(?${r.flags})${r.source}` : r.source;
  }

  return r;
};

@universalmind303
Copy link
Collaborator

#92

@universalmind303
Copy link
Collaborator

dropping in favor of #92

@Bidek56 Bidek56 deleted the regex-ignore-case-82 branch August 9, 2023 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants