8 best JavaScript Regex Libraries in 2024

share link

by Dhiren Gala dot icon Updated: Feb 15, 2024

technology logo
technology logo

Guide Kit Guide Kit  

Here are the best JavaScript Regex libraries for your web application. You can use regex in angular to perform form validation, pattern matching in routing, text parsing and manipulation, data filtering and search and replace operations.

 

Regex, short for "regular expression," is a pattern-matching tool used in various programming languages, including JavaScript. It allows you to match and manipulate strings of text based on specific patterns. Regex can be used to validate user input, search and replace text, and much more. It is written between two slashes (/pattern/) and can include special characters and metacharacters that represent sets of characters or match specific el­­ements of a string.

 

We have handpicked the best JavaScript libraries to perform regex pattern matching based on popularity, licensing, and unique features. 

xregexp:

  • Provides augmented regex beyond what is supported by browsers
  • Toolkit for grepping and parsing
  • Maintains cross browser compatibility 

xregexpby slevithan

JavaScript doticonstar image 3197 doticonVersion:v5.1.0doticon
License: Permissive (MIT)

Extended JavaScript regular expressions

Support
    Quality
      Security
        License
          Reuse

            xregexpby slevithan

            JavaScript doticon star image 3197 doticonVersion:v5.1.0doticon License: Permissive (MIT)

            Extended JavaScript regular expressions
            Support
              Quality
                Security
                  License
                    Reuse

                      emoji-regex:

                      • Used to match all Emoji-only symbols as per the Unicode Standard.
                      • Offers regular expressions for textual representations of emojis as well.
                      • It is based on emoji-test-regex-pattern.

                      emoji-regexby mathiasbynens

                      JavaScript doticonstar image 1514 doticonVersion:Currentdoticon
                      License: Permissive (MIT)

                      A regular expression to match all Emoji-only symbols as per the Unicode Standard.

                      Support
                        Quality
                          Security
                            License
                              Reuse

                                emoji-regexby mathiasbynens

                                JavaScript doticon star image 1514 doticonVersion:Currentdoticon License: Permissive (MIT)

                                A regular expression to match all Emoji-only symbols as per the Unicode Standard.
                                Support
                                  Quality
                                    Security
                                      License
                                        Reuse

                                          safe-regex:

                                          • Used in Utilities, Regex applications, etc.
                                          • Helps in detecting possibly catastrophic, exponential-time regular expressions.
                                          • Has both false positives and false negatives.

                                          safe-regexby substack

                                          JavaScript doticonstar image 698 doticonVersion:Currentdoticon
                                          License: Others (Non-SPDX)

                                          detect possibly catastrophic, exponential-time regular expressions

                                          Support
                                            Quality
                                              Security
                                                License
                                                  Reuse

                                                    safe-regexby substack

                                                    JavaScript doticon star image 698 doticonVersion:Currentdoticon License: Others (Non-SPDX)

                                                    detect possibly catastrophic, exponential-time regular expressions
                                                    Support
                                                      Quality
                                                        Security
                                                          License
                                                            Reuse

                                                              to-regex-range:

                                                              • Used for creating regular expressions to validate numbers, ranges, years, etc.
                                                              • Validated against more than 2.78 million test assertions.
                                                              • Offers a fast compiler and optimized regex.

                                                              to-regex-rangeby micromatch

                                                              JavaScript doticonstar image 97 doticonVersion:Currentdoticon
                                                              License: Permissive (MIT)

                                                              Pass two numbers, get a regex-compatible source string for matching ranges. Fast compiler, optimized regex, and validated against more than 2.78 million test assertions. Useful for creating regular expressions to validate numbers, ranges, years, etc.

                                                              Support
                                                                Quality
                                                                  Security
                                                                    License
                                                                      Reuse

                                                                        to-regex-rangeby micromatch

                                                                        JavaScript doticon star image 97 doticonVersion:Currentdoticon License: Permissive (MIT)

                                                                        Pass two numbers, get a regex-compatible source string for matching ranges. Fast compiler, optimized regex, and validated against more than 2.78 million test assertions. Useful for creating regular expressions to validate numbers, ranges, years, etc.
                                                                        Support
                                                                          Quality
                                                                            Security
                                                                              License
                                                                                Reuse

                                                                                  RegExr:

                                                                                  • Used for creating, testing, and learning about Regular Expressions.
                                                                                  • RegExr is a web-based tool for testing and learning regular expressions.
                                                                                  • Provides a user-friendly interface for writing complex regex patterns.

                                                                                  regexrby gskinner

                                                                                  JavaScript doticonstar image 9149 doticonVersion:3.6.1doticon
                                                                                  License: Strong Copyleft (GPL-3.0)

                                                                                  RegExr is a HTML/JS based tool for creating, testing, and learning about Regular Expressions.

                                                                                  Support
                                                                                    Quality
                                                                                      Security
                                                                                        License
                                                                                          Reuse

                                                                                            regexrby gskinner

                                                                                            JavaScript doticon star image 9149 doticonVersion:3.6.1doticon License: Strong Copyleft (GPL-3.0)

                                                                                            RegExr is a HTML/JS based tool for creating, testing, and learning about Regular Expressions.
                                                                                            Support
                                                                                              Quality
                                                                                                Security
                                                                                                  License
                                                                                                    Reuse

                                                                                                      regex101:

                                                                                                      • Used for testing and experimenting with regex patterns.
                                                                                                      • It’s an online regex tester and debugger.
                                                                                                      • Provides a simple and intuitive interface.

                                                                                                      regex101by nedrysoft

                                                                                                      JavaScript doticonstar image 101 doticonVersion:1.0doticon
                                                                                                      no licences License: No License (null)

                                                                                                      A cross platform (macOS, Linux & Windows) unofficial "offline" version of the regex101.com website. Uses the users own database (any qt supported backend - sqlite, mysql, postgresql etc) to store expressions.

                                                                                                      Support
                                                                                                        Quality
                                                                                                          Security
                                                                                                            License
                                                                                                              Reuse

                                                                                                                regex101by nedrysoft

                                                                                                                JavaScript doticon star image 101 doticonVersion:1.0doticonno licences License: No License

                                                                                                                A cross platform (macOS, Linux & Windows) unofficial "offline" version of the regex101.com website. Uses the users own database (any qt supported backend - sqlite, mysql, postgresql etc) to store expressions.
                                                                                                                Support
                                                                                                                  Quality
                                                                                                                    Security
                                                                                                                      License
                                                                                                                        Reuse

                                                                                                                          Js-regex:

                                                                                                                          • Used for functions like matching, extracting, and replacing parts of a string.
                                                                                                                          • Offer a chainable API for constructing RegExps, written in JavaScript.
                                                                                                                          • provides a number of convenient functions for working with regex patterns.

                                                                                                                          js-regexby wyantb

                                                                                                                          JavaScript doticonstar image 67 doticonVersion:Currentdoticon
                                                                                                                          License: Permissive (MIT)

                                                                                                                          A chainable API for constructing RegExps, written in Javascript

                                                                                                                          Support
                                                                                                                            Quality
                                                                                                                              Security
                                                                                                                                License
                                                                                                                                  Reuse

                                                                                                                                    js-regexby wyantb

                                                                                                                                    JavaScript doticon star image 67 doticonVersion:Currentdoticon License: Permissive (MIT)

                                                                                                                                    A chainable API for constructing RegExps, written in Javascript
                                                                                                                                    Support
                                                                                                                                      Quality
                                                                                                                                        Security
                                                                                                                                          License
                                                                                                                                            Reuse

                                                                                                                                              issue-regex:

                                                                                                                                              • Used for matching issue references with regular expression.
                                                                                                                                              • Can check expressions such as organization name, repository name, and issue number.
                                                                                                                                              • Returns a RegExp for matching issue references.

                                                                                                                                              issue-regexby sindresorhus

                                                                                                                                              JavaScript doticonstar image 34 doticonVersion:v3.1.0doticon
                                                                                                                                              License: Permissive (MIT)

                                                                                                                                              Regular expression for matching issue references

                                                                                                                                              Support
                                                                                                                                                Quality
                                                                                                                                                  Security
                                                                                                                                                    License
                                                                                                                                                      Reuse

                                                                                                                                                        issue-regexby sindresorhus

                                                                                                                                                        JavaScript doticon star image 34 doticonVersion:v3.1.0doticon License: Permissive (MIT)

                                                                                                                                                        Regular expression for matching issue references
                                                                                                                                                        Support
                                                                                                                                                          Quality
                                                                                                                                                            Security
                                                                                                                                                              License
                                                                                                                                                                Reuse

                                                                                                                                                                  See similar Kits and Libraries