CINXE.COM

Regex Tutorial - Turning Modes On and Off for Only Part of The Regular Expression

<!DOCTYPE html> <html lang="en"><head><meta charset="utf-8"><link rel=canonical href='https://https://www.regular-expressions.info//modifiers.html'><title>Regex Tutorial - Turning Modes On and Off for Only Part of The Regular Expression</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="author" content="Jan Goyvaerts"> <meta name="description" content=""> <meta name="keywords" content=""> <link rel=stylesheet href="regex.css" type="text/css"><script src="theme.js" type="text/javascript"></script><link rel="alternate" type="application/rss+xml" title="New at Regular-Expressions.info" href="updates.xml"> </head> <body bgcolor=white text=black> <div id=top></div> <div id=btntop><div id=btngrid><a href="quickstart.html" target="_top"><div>Quick&nbsp;Start</div></a><a href="tutorial.html" target="_top"><div>Tutorial</div></a><a href="tools.html" target="_top"><div>Tools&nbsp;&amp;&nbsp;Languages</div></a><a href="examples.html" target="_top"><div>Examples</div></a><a href="refflavors.html" target="_top"><div>Reference</div></a><a href="books.html" target="_top"><div>Book&nbsp;Reviews</div></a></div></div> <div id=contents><div id=side> <TABLE CLASS=side CELLSPACING=0 CELLPADDING=4><TR><TD CLASS=sideheader>Regex Tutorial</TD></TR><TR><TD><A HREF="tutorial.html" TARGET=_top>Introduction</A></TD></TR><TR><TD><A HREF="tutorialcnt.html" TARGET=_top>Table of Contents</A></TD></TR><TR><TD><A HREF="characters.html" TARGET=_top>Special Characters</A></TD></TR><TR><TD><A HREF="nonprint.html" TARGET=_top>Non-Printable Characters</A></TD></TR><TR><TD><A HREF="engine.html" TARGET=_top>Regex Engine Internals</A></TD></TR><TR><TD><A HREF="charclass.html" TARGET=_top>Character Classes</A></TD></TR><TR><TD><A HREF="charclasssubtract.html" TARGET=_top>Character Class Subtraction</A></TD></TR><TR><TD><A HREF="charclassintersect.html" TARGET=_top>Character Class Intersection</A></TD></TR><TR><TD><A HREF="shorthand.html" TARGET=_top>Shorthand Character Classes</A></TD></TR><TR><TD><A HREF="dot.html" TARGET=_top>Dot</A></TD></TR><TR><TD><A HREF="anchors.html" TARGET=_top>Anchors</A></TD></TR><TR><TD><A HREF="wordboundaries.html" TARGET=_top>Word Boundaries</A></TD></TR><TR><TD><A HREF="alternation.html" TARGET=_top>Alternation</A></TD></TR><TR><TD><A HREF="optional.html" TARGET=_top>Optional Items</A></TD></TR><TR><TD><A HREF="repeat.html" TARGET=_top>Repetition</A></TD></TR><TR><TD><A HREF="brackets.html" TARGET=_top>Grouping &amp; Capturing</A></TD></TR><TR><TD><A HREF="backref.html" TARGET=_top>Backreferences</A></TD></TR><TR><TD><A HREF="backref2.html" TARGET=_top>Backreferences, part 2</A></TD></TR><TR><TD><A HREF="named.html" TARGET=_top>Named Groups</A></TD></TR><TR><TD><A HREF="backrefrel.html" TARGET=_top>Relative Backreferences</A></TD></TR><TR><TD><A HREF="branchreset.html" TARGET=_top>Branch Reset Groups</A></TD></TR><TR><TD><A HREF="freespacing.html" TARGET=_top>Free-Spacing &amp; Comments</A></TD></TR><TR><TD><A HREF="unicode.html" TARGET=_top>Unicode</A></TD></TR><TR><TD><A HREF="modifiers.html" TARGET=_top>Mode Modifiers</A></TD></TR><TR><TD><A HREF="atomic.html" TARGET=_top>Atomic Grouping</A></TD></TR><TR><TD><A HREF="possessive.html" TARGET=_top>Possessive Quantifiers</A></TD></TR><TR><TD><A HREF="lookaround.html" TARGET=_top>Lookahead &amp; Lookbehind</A></TD></TR><TR><TD><A HREF="lookaround2.html" TARGET=_top>Lookaround, part 2</A></TD></TR><TR><TD><A HREF="keep.html" TARGET=_top>Keep Text out of The Match</A></TD></TR><TR><TD><A HREF="conditional.html" TARGET=_top>Conditionals</A></TD></TR><TR><TD><A HREF="balancing.html" TARGET=_top>Balancing Groups</A></TD></TR><TR><TD><A HREF="recurse.html" TARGET=_top>Recursion</A></TD></TR><TR><TD><A HREF="subroutine.html" TARGET=_top>Subroutines</A></TD></TR><TR><TD><A HREF="recurseinfinite.html" TARGET=_top>Infinite Recursion</A></TD></TR><TR><TD><A HREF="recurserepeat.html" TARGET=_top>Recursion &amp; Quantifiers</A></TD></TR><TR><TD><A HREF="recursecapture.html" TARGET=_top>Recursion &amp; Capturing</A></TD></TR><TR><TD><A HREF="recursebackref.html" TARGET=_top>Recursion &amp; Backreferences</A></TD></TR><TR><TD><A HREF="recursebacktrack.html" TARGET=_top>Recursion &amp; Backtracking</A></TD></TR><TR><TD><A HREF="posixbrackets.html" TARGET=_top>POSIX Bracket Expressions</A></TD></TR><TR><TD><A HREF="zerolength.html" TARGET=_top>Zero-Length Matches</A></TD></TR><TR><TD><A HREF="continue.html" TARGET=_top>Continuing Matches</A></TD></TR> </TABLE><TABLE CLASS=side CELLSPACING=0 CELLPADDING=4><TR><TD CLASS=sideheader>More on This Site</TD></TR><TR><TD><A HREF="index.html" TARGET=_top>Introduction</A></TD></TR><TR><TD><A HREF="quickstart.html" TARGET=_top>Regular Expressions Quick Start</A></TD></TR><TR><TD><A HREF="tutorial.html" TARGET=_top>Regular Expressions Tutorial</A></TD></TR><TR><TD><A HREF="replacetutorial.html" TARGET=_top>Replacement Strings Tutorial</A></TD></TR><TR><TD><A HREF="tools.html" TARGET=_top>Applications and Languages</A></TD></TR><TR><TD><A HREF="examples.html" TARGET=_top>Regular Expressions Examples</A></TD></TR><TR><TD><A HREF="refflavors.html" TARGET=_top>Regular Expressions Reference</A></TD></TR><TR><TD><A HREF="refreplace.html" TARGET=_top>Replacement Strings Reference</A></TD></TR><TR><TD><A HREF="books.html" TARGET=_top>Book Reviews</A></TD></TR><TR><TD><A HREF="print.html" TARGET=_top>Printable PDF</A></TD></TR><TR><TD><A HREF="about.html" TARGET=_top>About This Site</A></TD></TR><TR><TD><A HREF="updates.html" TARGET=_top>RSS Feed &amp; Blog</A></TD></TR></TABLE></DIV><div class=bodytext><div class=topad style="height:130px"><A HREF="https://www.regexbuddy.com/create.html" TARGET="_top"><picture><source media="(max-width: 370px)" srcset="ads/320/rxbtutorial100.png 1x, ads/320/rxbtutorial150.png 1.5x, ads/320/rxbtutorial200.png 2x, ads/320/rxbtutorial250.png 2.5x, ads/320/rxbtutorial300.png 3x, ads/320/rxbtutorial350.png 3.5x, ads/320/rxbtutorial400.png 4x"><source media="(max-width: 500px)" srcset="ads/360/rxbtutorial100.png 1x, ads/360/rxbtutorial150.png 1.5x, ads/360/rxbtutorial200.png 2x, ads/360/rxbtutorial250.png 2.5x, ads/360/rxbtutorial300.png 3x, ads/360/rxbtutorial350.png 3.5x, ads/360/rxbtutorial400.png 4x"><source media="(max-width: 660px)" srcset="ads/480/rxbtutorial100.png 1x, ads/480/rxbtutorial150.png 1.5x, ads/480/rxbtutorial200.png 2x, ads/480/rxbtutorial250.png 2.5x, ads/480/rxbtutorial300.png 3x, ads/480/rxbtutorial350.png 3.5x, ads/480/rxbtutorial400.png 4x"><source media="(max-width: 747px)" srcset="ads/640/rxbtutorial100.png 1x, ads/640/rxbtutorial150.png 1.5x, ads/640/rxbtutorial200.png 2x, ads/640/rxbtutorial250.png 2.5x, ads/640/rxbtutorial300.png 3x, ads/640/rxbtutorial350.png 3.5x, ads/640/rxbtutorial400.png 4x"><img src="ads/728/rxbtutorial100.png" srcset="ads/728/rxbtutorial100.png 1x, ads/728/rxbtutorial125.png 1.25x, ads/728/rxbtutorial150.png 1.5x, ads/728/rxbtutorial175.png 1.75x, ads/728/rxbtutorial200.png 2x, ads/728/rxbtutorial250.png 2.5x, ads/728/rxbtutorial300.png 3x, ads/728/rxbtutorial350.png 3.5x, ads/728/rxbtutorial400.png 4x" alt="RegexBuddy—Better than a regular expression tutorial!"></picture></A></div> <div class=bulb><h1>Specifying Modes Inside The Regular Expression</h1><script type="text/javascript">showbulb();</script></div> <p>Normally, matching modes are specified outside the regular expression. In a programming language, you pass them as a flag to the regex constructor or append them to the regex literal. In an application, you’d toggle the appropriate buttons or checkboxes. You can find the specifics in the <A HREF="tools.html" TARGET="_top">tools and languages</A> section of this website.</p> <p>Sometimes, the tool or language does not provide the ability to specify matching options. The handy <tt class=code>String.matches()</tt> method in <A HREF="java.html" TARGET="_top">Java</A> does not take a parameter for matching options like <tt class=code>Pattern.compile()</tt> does. Or, the regex flavor may support matching modes that aren’t exposed as external flags. The regex functions in <A HREF="rlanguage.html" TARGET="_top">R</A> have <tt>ignore.case</tt> as their only option, even though the underlying PCRE library has more matching modes than any other discussed in this tutorial.</p> <p>In those situation, you can add the following mode modifiers to the start of the regex. To specify multiple modes, simply put them together as in <TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">i</SPAN><SPAN CLASS="regexmeta">s</SPAN><SPAN CLASS="regexmeta">m</SPAN><SPAN CLASS="regexmeta">x</SPAN><SPAN CLASS="regexmeta">)</SPAN></TT>.</p> <ul> <li><TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">i</SPAN><SPAN CLASS="regexmeta">)</SPAN></TT> makes the regex case insensitive.</li> <li><TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">c</SPAN><SPAN CLASS="regexmeta">)</SPAN></TT> makes the regex case sensitive. Only supported by <A HREF="tcl.html" TARGET="_top">Tcl</A>.</li> <li><TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">x</SPAN><SPAN CLASS="regexmeta">)</SPAN></TT> turn on <A HREF="freespacing.html" TARGET="_top">free-spacing mode</A>.</li> <li><TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">t</SPAN><SPAN CLASS="regexmeta">)</SPAN></TT> turn off free-spacing mode. Only supported by Tcl.</li> <li><TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">x</SPAN><SPAN CLASS="regexmeta">x</SPAN><SPAN CLASS="regexmeta">)</SPAN></TT> turn on <A HREF="freespacing.html" TARGET="_top">free-spacing mode</A>, also in character classes. Supported by Perl 5.26 and PCRE2 10.30.</li> <li><TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">s</SPAN><SPAN CLASS="regexmeta">)</SPAN></TT> for “single line mode” makes the <A HREF="dot.html" TARGET="_top">dot</A> match all characters, including line breaks. Not supported by <A HREF="ruby.html" TARGET="_top">Ruby</A>. In Tcl, <TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">s</SPAN><SPAN CLASS="regexmeta">)</SPAN></TT> also makes the caret and dollar match at the start and end of the string only.</li> <li><TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">m</SPAN><SPAN CLASS="regexmeta">)</SPAN></TT> for “multi-line mode” makes the <A HREF="anchors.html" TARGET="_top">caret and dollar</A> match at the start and end of each line in the subject string. In Ruby, <TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">m</SPAN><SPAN CLASS="regexmeta">)</SPAN></TT> makes the dot match all characters, without affecting the caret and dollar which always match at the start and end of each line in Ruby. In Tcl, <TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">m</SPAN><SPAN CLASS="regexmeta">)</SPAN></TT> also prevents the dot from matching line breaks.</li> <li><TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">p</SPAN><SPAN CLASS="regexmeta">)</SPAN></TT> in Tcl makes the caret and dollar match at the start and the end of each line, and makes the dot match line breaks.</li> <li><TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">w</SPAN><SPAN CLASS="regexmeta">)</SPAN></TT> in Tcl makes the caret and dollar match only at the start and the end of the subject string, and prevents the dot from matching line breaks.</li> <li><TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">n</SPAN><SPAN CLASS="regexmeta">)</SPAN></TT> turns all <a href="named.html#number">unnamed groups</a> into non-capturing groups. Only supported by <A HREF="dotnet.html" TARGET="_top">.NET</A>, <A HREF="xregexp.html" TARGET="_top">XRegExp</A>, and the <A HREF="jgsoft.html" TARGET="_top">JGsoft flavor</A>. In Tcl, <TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">n</SPAN><SPAN CLASS="regexmeta">)</SPAN></TT> is the same as <TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">m</SPAN><SPAN CLASS="regexmeta">)</SPAN></TT>.</li> <li><TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">J</SPAN><SPAN CLASS="regexmeta">)</SPAN></TT> allows <a href="named.html#duplicate">duplicate group names</a>. Only supported by <A HREF="pcre.html" TARGET="_top">PCRE</A> and languages that use it such as <A HREF="delphi.html" TARGET="_top">Delphi</A>, <A HREF="php.html" TARGET="_top">PHP</A> and <A HREF="rlanguage.html" TARGET="_top">R</A>.</li> <li><TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">U</SPAN><SPAN CLASS="regexmeta">)</SPAN></TT> turns on “ungreedy mode”, which switches the syntax for greedy and lazy quantifiers. So <TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">U</SPAN><SPAN CLASS="regexmeta">)</SPAN><SPAN CLASS="regexplain">a</SPAN><SPAN CLASS="regexspecial">*</SPAN></TT> is lazy and <TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">U</SPAN><SPAN CLASS="regexmeta">)</SPAN><SPAN CLASS="regexplain">a</SPAN><SPAN CLASS="regexspecial">*</SPAN><SPAN CLASS="regexspecial">?</SPAN></TT> is greedy. Only supported by PCRE and languages that use it. Its use is strongly discouraged because it confuses the meaning of the standard quantifier syntax.</li> <li><TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">d</SPAN><SPAN CLASS="regexmeta">)</SPAN></TT> corresponds with UNIX_LINES in <A HREF="java.html" TARGET="_top">Java</A>, which makes the dot, caret, and dollar treat only the newline character <TT CLASS=syntax><SPAN CLASS="regexspecial">\n</SPAN></TT> as a line break, instead of recognizing all line break characters from the Unicode standard. Whether they match or don’t match (at) line breaks depends on <TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">s</SPAN><SPAN CLASS="regexmeta">)</SPAN></TT> and <TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">m</SPAN><SPAN CLASS="regexmeta">)</SPAN></TT>.</li> <li><TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">b</SPAN><SPAN CLASS="regexmeta">)</SPAN></TT> makes Tcl interpret the regex as a POSIX BRE.</li> <li><TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">e</SPAN><SPAN CLASS="regexmeta">)</SPAN></TT> makes Tcl interpret the regex as a POSIX ERE.</li> <li><TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">q</SPAN><SPAN CLASS="regexmeta">)</SPAN></TT> makes Tcl interpret the regex as a literal string (minus the <tt>(?q)</tt> characters).</li> <li><TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">X</SPAN><SPAN CLASS="regexmeta">)</SPAN></TT> makes escaping letters with a backslash an error if that combination is not a valid regex token. Only supported by PCRE and languages that use it.</li> </ul> <h2>Turning Modes On and Off for Only Part of The Regular Expression</h2> <p>Modern regex flavors allow you to apply modifiers to only part of the regular expression. If you insert the modifier <TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">i</SPAN><SPAN CLASS="regexmeta">s</SPAN><SPAN CLASS="regexmeta">m</SPAN><SPAN CLASS="regexmeta">)</SPAN></TT> in the middle of the regex then the modifier only applies to the part of the regex to the right of the modifier. With these flavors, you can turn off modes by preceding them with a minus sign. All modes after the minus sign will be turned off. E.g. <TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">i</SPAN><SPAN CLASS="regexmeta">-</SPAN><SPAN CLASS="regexmeta">s</SPAN><SPAN CLASS="regexmeta">m</SPAN><SPAN CLASS="regexmeta">)</SPAN></TT> turns on case insensitivity, and turns off both single-line mode and multi-line mode.</p> <p>If a flavor can’t apply modifiers to only part of the regex then it treats modifiers in the middle of the regex as an error. <A HREF="python.html" TARGET="_top">Python</A> is an exception to this. In Python, putting a modifier in the middle of the regex affects the whole regex. So in Python, <TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">i</SPAN><SPAN CLASS="regexmeta">)</SPAN><SPAN CLASS="regexplain">caseless</SPAN></TT> and <TT CLASS=syntax><SPAN CLASS="regexplain">caseless</SPAN><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">i</SPAN><SPAN CLASS="regexmeta">)</SPAN></TT> are both case insensitive. In all other flavors, the trailing mode modifier either has no effect or is an error.</p> <p>You can quickly test how the regex flavor you’re using handles mode modifiers. The regex <TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">i</SPAN><SPAN CLASS="regexmeta">)</SPAN><SPAN CLASS="regexplain">te</SPAN><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">-</SPAN><SPAN CLASS="regexmeta">i</SPAN><SPAN CLASS="regexmeta">)</SPAN><SPAN CLASS="regexplain">st</SPAN></TT> should match <tt class=match>test</tt> and <tt class=match>TEst</tt>, but not <tt class=string>teST</tt> or <tt class=string>TEST</tt>.</p> <h2>Modifier Spans</h2> <p>Instead of using two modifiers, one to turn an option on, and one to turn it off, you use a modifier span. <TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">i</SPAN><SPAN CLASS="regexmeta">)</SPAN><SPAN CLASS="regexplain">caseless</SPAN><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">-</SPAN><SPAN CLASS="regexmeta">i</SPAN><SPAN CLASS="regexmeta">)</SPAN><SPAN CLASS="regexplain">cased</SPAN><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">i</SPAN><SPAN CLASS="regexmeta">)</SPAN><SPAN CLASS="regexplain">caseless</SPAN></TT> is equivalent to <TT CLASS=syntax><SPAN CLASS="regexmeta">(?</SPAN><SPAN CLASS="regexmeta">i</SPAN><SPAN CLASS="regexmeta">)</SPAN><SPAN CLASS="regexplain">caseless</SPAN><SPAN CLASS="regexnest1">(?</SPAN><SPAN CLASS="regexnest1">-</SPAN><SPAN CLASS="regexnest1">i:</SPAN><SPAN CLASS="regexplain">cased</SPAN><SPAN CLASS="regexnest1">)</SPAN><SPAN CLASS="regexplain">caseless</SPAN></TT>. This syntax resembles that of the <A HREF="brackets.html" TARGET="_top">non-capturing group</A> <TT CLASS=syntax><SPAN CLASS="regexnest1">(?:</SPAN><SPAN CLASS="regexplain">group</SPAN><SPAN CLASS="regexnest1">)</SPAN></TT>. You could think of a non-capturing group as a modifier span that does not change any modifiers. But there are flavors, like <A HREF="javascript.html" TARGET="_top">JavaScript</A>, <A HREF="python.html" TARGET="_top">Python</A>, and <A HREF="tcl.html" TARGET="_top">Tcl</A> that support non-capturing groups even though they do not support modifier spans. Like a non-capturing group, the modifier span does not create a <A HREF="backref.html" TARGET="_top">backreference</A>.</p> <p>Modifier spans are supported by all regex flavors that allow you to use mode modifiers in the middle of the regular expression, and by those flavors only. These include the <A HREF="jgsoft.html" TARGET="_top">JGsoft engine</A>, <A HREF="dotnet.html" TARGET="_top">.NET</A>, <A HREF="java.html" TARGET="_top">Java</A>, <A HREF="perl.html" TARGET="_top">Perl</A> and <A HREF="pcre.html" TARGET="_top">PCRE</A>, <A HREF="php.html" TARGET="_top">PHP</A>, <A HREF="delphi.html" TARGET="_top">Delphi</A>, and <A HREF="rlanguage.html" TARGET="_top">R</A>.</p><div id=cntmobi><p>|&ensp;<a href='quickstart.html'>Quick&nbsp;Start</a>&ensp;|&ensp;<a href='tutorial.html'>Tutorial</a>&ensp;|&ensp;<a href='tools.html'>Tools&nbsp;&amp;&nbsp;Languages</a>&ensp;|&ensp;<a href='examples.html'>Examples</a>&ensp;|&ensp;<a href='refflavors.html'>Reference</a>&ensp;|&ensp;<a href='books.html'>Book&nbsp;Reviews</a>&ensp;|</p><p>|&ensp;<a href='tutorial.html'>Introduction</a>&ensp;|&ensp;<a href='tutorialcnt.html'>Table of Contents</a>&ensp;|&ensp;<a href='characters.html'>Special Characters</a>&ensp;|&ensp;<a href='nonprint.html'>Non-Printable Characters</a>&ensp;|&ensp;<a href='engine.html'>Regex Engine Internals</a>&ensp;|&ensp;<a href='charclass.html'>Character Classes</a>&ensp;|&ensp;<a href='charclasssubtract.html'>Character Class Subtraction</a>&ensp;|&ensp;<a href='charclassintersect.html'>Character Class Intersection</a>&ensp;|&ensp;<a href='shorthand.html'>Shorthand Character Classes</a>&ensp;|&ensp;<a href='dot.html'>Dot</a>&ensp;|&ensp;<a href='anchors.html'>Anchors</a>&ensp;|&ensp;<a href='wordboundaries.html'>Word Boundaries</a>&ensp;|&ensp;<a href='alternation.html'>Alternation</a>&ensp;|&ensp;<a href='optional.html'>Optional Items</a>&ensp;|&ensp;<a href='repeat.html'>Repetition</a>&ensp;|&ensp;<a href='brackets.html'>Grouping &amp; Capturing</a>&ensp;|&ensp;<a href='backref.html'>Backreferences</a>&ensp;|&ensp;<a href='backref2.html'>Backreferences, part 2</a>&ensp;|&ensp;<a href='named.html'>Named Groups</a>&ensp;|&ensp;<a href='backrefrel.html'>Relative Backreferences</a>&ensp;|&ensp;<a href='branchreset.html'>Branch Reset Groups</a>&ensp;|&ensp;<a href='freespacing.html'>Free-Spacing &amp; Comments</a>&ensp;|&ensp;<a href='unicode.html'>Unicode</a>&ensp;|&ensp;<a href='modifiers.html'>Mode Modifiers</a>&ensp;|&ensp;<a href='atomic.html'>Atomic Grouping</a>&ensp;|&ensp;<a href='possessive.html'>Possessive Quantifiers</a>&ensp;|&ensp;<a href='lookaround.html'>Lookahead &amp; Lookbehind</a>&ensp;|&ensp;<a href='lookaround2.html'>Lookaround, part 2</a>&ensp;|&ensp;<a href='keep.html'>Keep Text out of The Match</a>&ensp;|&ensp;<a href='conditional.html'>Conditionals</a>&ensp;|&ensp;<a href='balancing.html'>Balancing Groups</a>&ensp;|&ensp;<a href='recurse.html'>Recursion</a>&ensp;|&ensp;<a href='subroutine.html'>Subroutines</a>&ensp;|&ensp;<a href='recurseinfinite.html'>Infinite Recursion</a>&ensp;|&ensp;<a href='recurserepeat.html'>Recursion &amp; Quantifiers</a>&ensp;|&ensp;<a href='recursecapture.html'>Recursion &amp; Capturing</a>&ensp;|&ensp;<a href='recursebackref.html'>Recursion &amp; Backreferences</a>&ensp;|&ensp;<a href='recursebacktrack.html'>Recursion &amp; Backtracking</a>&ensp;|&ensp;<a href='posixbrackets.html'>POSIX Bracket Expressions</a>&ensp;|&ensp;<a href='zerolength.html'>Zero-Length Matches</a>&ensp;|&ensp;<a href='continue.html'>Continuing Matches</a>&ensp;|</p></div> <div id=copyright> <P CLASS=copyright>Page URL: <A HREF="https://www.regular-expressions.info/modifiers.html" TARGET="_top">https://www.regular-expressions.info/modifiers.html</A><BR> Page last updated: 2 September 2021<BR> Site last updated: 06 November 2024<BR> Copyright &copy; 2003-2024 Jan Goyvaerts. All rights reserved.</P> </div> </div> </div> </body></html>

Pages: 1 2 3 4 5 6 7 8 9 10