• Skip to main content
  • Skip to search
  • Skip to select language
HTML

Structure of content on the web

  • Web APIs

    Interfaces for building web applications

  • Learn
    • CSS

      Learn to style content using CSS

    • Overview

      A customized MDN experience

    • FAQ

      Frequently asked questions about MDN Plus

  • HTTP Observatory

    Scan a website for free

  • JavaScript
  • unicode
      • Deutsch
      • Français
      • 日本語
      • 한국어
      • Русский
      • 中文 (简体)

    In this article

    • Try it
    • Description
    • Examples
    • Specifications
    • Browser compatibility
    • See also
    1. escape()
  • Static properties
    1. $1, …, $9 Deprecated
    2. input ($_) Deprecated
    3. lastMatch ($&) Deprecated
    4. lastParen ($+) Deprecated
    5. leftContext ($`) Deprecated
    6. rightContext ($') Deprecated
    7. compile() Deprecated
    8. [Symbol.match]()
    9. [Symbol.split]()
  • Instance properties
    1. global
    2. source
    3. Object/Function
    4. Static methods
      1. toString()
      2. displayName Non-standard
      3. arguments Non-standard Deprecated
      4. caller Non-standard Deprecated
    5. Instance methods
      1. __defineGetter__() Deprecated
      2. __defineSetter__() Deprecated
      3. __lookupGetter__() Deprecated
      4. __lookupSetter__() Deprecated
      5. toLocaleString()
      6. __proto__ Deprecated
      7. RegExp instances returns whether or not the u flag is used with this regular expression.

  • Try it

    const regex1 = /\u{61}/;
    const regex2 = /\u{61}/u;
    
    console.log(regex1.unicode);
    / Expected output: false
    
    console.log(regex2.unicode);
    / Expected output: true
    

    Description

    RegExp.prototype.unicode has the value true if the u flag was used; otherwise, false. The u flag enables various Unicode-related features. With the "u" flag:

    • Any Unicode code point escapes (\u{xxxx}, \p{UnicodePropertyValue}) will be interpreted as such instead of identity escapes. For example /\u{61}/u matches "a", but /\u{61}/ (without u flag) matches "u".repeat(61), where the \u is equivalent to a single u.
    • Surrogate pairs will be interpreted as whole characters instead of two separate characters. For example, /[😄]/u would only match "😄" but not "\ud83d".
    • When exec()), unicode regexes advance by Unicode code points instead of UTF-16 code units.

    There are other changes to the parsing behavior that prevent possible syntax mistakes (which are analogous to deprecated and only kept for web compatibility, and you should not rely on them.

    The set accessor of unicode is undefined. You cannot change this property directly.

    Unicode-aware mode

    When we refer to Unicode-aware mode, we mean the regex has either the u or the SyntaxError.

    Similarly, a regex is Unicode-unaware if it has neither the u nor the v flag. In this case, the regex is interpreted as a sequence of UTF-16 code units, and there are many legacy syntaxes that do not become syntax errors.

    Examples

    Using the unicode property

    js
    const regex = /\u{61}/u;
    
    console.log(regex.unicode); / true
    

    Specifications

    Specification
    ECMAScript® 2026 Language Specification
    # sec-get-regexp.prototype.unicode

    Browser compatibility

    See also

    • RegExp.prototype.lastIndex
    • RegExp.prototype.dotAll
    • RegExp.prototype.global
    • RegExp.prototype.hasIndices
    • RegExp.prototype.ignoreCase
    • RegExp.prototype.multiline
    • RegExp.prototype.source
    • RegExp.prototype.sticky

    Help improve MDN

    RegExp object represents a regular expression, a notation for matching text patterns.","name":"Regular expressions"}},"browserCompat":["javascript.builtins.RegExp.unicode"],"pageType":"javascript-instance-accessor-property"}}

    Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

    Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant