In JavaScript, regular expressions are also objects

There are a number of special characters that can be used when constructing a regular expression.

Regex Tutorial—From Regex 101 to Advanced Regex

For purposes of presenting examples in this tutorial, regular expressions described will be surrounded by forward slashes. This style of delimiting regular expressions is used by , , perl and other tools. For instance, an example might mention:

Regular Expressions - JavaScript | MDN

In this example, the Perl regular expression is . The number of times tosearch for a match is -1. The source string is 'Jones, Fred'. The value -1specifies that matching patterns continue to be replaced until the end ofthe source is reached.

Many examples will be accompanied by an illustration that shows a regular expression, and a text that is highlighted for every match on that expression.

Perl Regular Expressions by Example Introduction

There are a few variations in regular expression syntax between different tools that use them. Some tools add enhanced capabilities that are not available everywhere. In general, for the simplest cases, this tutorial will use examples based around or . For a few more exotic capabilities, Perl or Python examples will be chosen. For the most part, examples will work anywhere; but check the documentation on your own tool for syntax variations and capabilities.

Regular expressions and 'capturing parentheses' ..

In this chapter, I will discuss one suchtool, regular expressions. Regular expressions are a way todescribe patterns in string data. They form a small, separatelanguage that is part of JavaScript and many other languages andtools.

Matching Parenthesis Pairs Using Regular Expressions

Regular expressions are both terribly awkwardand extremely useful. Their syntax is cryptic, and the programminginterface JavaScript provides for them is clumsy. But they are apowerful tool for inspecting and processing strings. Properlyunderstanding regular expressions will make you a more effectiveprogrammer.

Regular Expressions Regular Expression Syntax ..

Build a Perl regular expression to identifya phone number that matches (XXX)XXX-XXXX, and assign the variable PAREN tohold the result. Use the following syntax elements to build the Perl regularexpression:

An explanation of the syntax for regular expressions in ..

In this chapter, you’ll start by writing a program to find text patterns using regular expressions and then see how to use regular expressions to make the code much less bloated. I’ll show you basic matching with regular expressions and then move on to some more powerful features, such as string substitution and creating your own character classes. Finally, at the end of the chapter, you’ll write a program that can automatically extract phone numbers and email addresses from a block of text.

Regular Expressions :: Eloquent JavaScript

Build a Perl regular expression that concatenatesthe regular expressions for (XXX)XXX-XXXX and XXX--XXX--XXXX. Theconcatenation enables you to search for both phone number formats from oneregular expression.