Skip to content

Improve db util regular expression #2859

Closed
@jsumners-nr

Description

// Suppressing a warning on this regex because it is not obvious what this
// regex does, and we don't want to break anything.
// eslint-disable-next-line sonarjs/slow-regex, sonarjs/duplicates-in-character-class
const match = /^\s*use[^\w`]+([\w$_\u0080-\uFFFF]+|`[^`]+`)[\s;]*$/i.exec(sql)
return (match && match[1]) || null

This regular expression is triggering sonar-js's "slow regex" rule. We need to investigate what the regular expression does, and see if we can improve it.

Metadata

Assignees

Labels

Type

No type

Projects

  • Status

    Done: Issues recently completed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions