Regular expression examples: Difference between revisions

Content deleted Content added
Clarified the character-class abbreviations per UTS#18
Line 152:
<tr>
<td>\b</td>
<td>Matches a wordzero-width boundary between a word-class character (see next) and either a non-word class character or an edge.</td>
<td align="left">
<source lang="perl">
Line 164:
<tr>
<td>\w</td>
<td>Matches an alphanumeric character, including "_"; same as [A-Za-z0-9_] in ASCII. In Unicode</tdref>{{Cite web
| title = UTS#18 on Unicode Regular Expressions, Annex A: Character Blocks
| url = http://unicode.org/reports/tr18/#Character_Blocks
| accessdate = 2010-02-05}}</ref> same as [\p{Alphabetic}\p{Mark}\p{Decimal_Number\p{Connector_Punctuation}], where the Alphabetic property contains more than just Letters, and the Decimal_Number property contains more than [0-9].</td>
<td align="left">
<source lang="perl">
Line 177 ⟶ 180:
<tr>
<td>\W</td>
<td>Matches a '''non'''-alphanumeric character, excluding "_"; same as [^A-Za-z0-9_] in ASCII, and [^\p{Alphabetic}\p{GC=Mark}\p{GC=Decimal_Number}\p{GC=Connector_Punctuation}] in Unicode.</td>
<td align="left">
<source lang="perl">
Line 190 ⟶ 193:
<tr>
<td>\s</td>
<td>Matches a whitespace character (space, which in ASCII are tab, newlineline feed, form feed, carriage return, and space; in Unicode, also matches no-break spaces, next line, and the variable-width spaces (amongst others). </td>
<td align="left">
<source lang="perl">
Line 216 ⟶ 219:
<tr>
<td>\d</td>
<td>Matches a digit; same as [0-9] in ASCII; in Unicode, same as the \p{Digit} or \p{GC=Decimal_Number} property, which itself the same as the \p{Numeric_Type=Decimal} property. </td>
<td align="left">
<source lang="perl">
Line 230 ⟶ 233:
<tr>
<td>\D</td>
<td>Matches a non-digit; same as [^0-9] in ASCII or \P{Digit} in Unicode.</td>
<td align="left">
<source lang="perl">