Regular expression examples: Difference between revisions

Content deleted Content added
Yobot (talk | contribs)
m WP:CHECKWIKI error 26 + genfixes using AWB (7165)
Jwarhol (talk | contribs)
Improve consistency and make minor typographic corrections
Line 18:
== Examples ==
 
Unless otherwise indicated, the following examples conform to the [[Perl]] programming language, release 5.8.8, January 31, 2006. This means, that other implementations may lack support for some parts of the syntax, as shown here (e.g. basic vs. extended regex, \( \) vs. (), or lack of \d instead of [[POSIX]] [:digit:]).
 
The syntax and conventions used in these examples coincide with that of other programming environments as well (e.g., see Java in a Nutshell — Page 213, Python Scripting for Computational Science — Page 320, Programming PHP — Page 106 ).
 
<table class="wikitable">
Line 51:
print "We matched '$1' and '$2'\n";
}
 
</pre>'''Output:'''<pre>
We matched 'Hel' and 'o W';
Line 87 ⟶ 86:
<tr>
<td>?</td>
<td>Modifies the *, +, or {M,N}'d regexpregex that comes before
to match as few times as possible.</td>
<td align="left">
Line 159 ⟶ 158:
if ($string1 =~ m/llo\b/) {
print "There is a word that ends with 'llo'\n";
} else {
print "There are no words that end with 'llo'\n";
}
</pre></td>
Line 226 ⟶ 223:
print "$1 is the first number in '$string1'\n";
}
 
</pre>'''Output:'''<pre>
99 is the first number in '99 bottles of beer on the wall.'
Line 285 ⟶ 281:
<tr>
<td>\z</td>
<td>Matches the end of a string (but not an internal line).<br/> see Perl Best Practices&nbsp;— Page 240</td>
<td align="left">
<pre>