JS Built-ins
RegExpflagsbeginner

RegExp flags β€” im flags

πŸ“– Usage Example
const re = /hello/gi
console.log(re.flags) // β†’ 'gi'

Read RegExp.flags to get a string of all active flags on the regular expression.

RegExp.prototype.flags

Flags are sorted alphabetically, so im stays im.

Challenge: Verify that /hello/im.flags equals 'im'.

πŸ’‘ Hints (1)
  • β€’ Flags are returned alphabetically: d, g, i, m, s, u, v, y