Regex: Difference between revisions
Content added Content deleted
Line 6: | Line 6: | ||
== Metacharacters == |
== Metacharacters == |
||
{| class="wikitable" |
{| class="wikitable" style="width:80%" |
||
|- |
|- |
||
!colspan=2| Metacharacters Defined !!colspan=2| Metacharacter Examples |
!colspan=2| Metacharacters Defined !!colspan=2| Metacharacter Examples |
||
|- |
|- |
||
! MChar !! Definition !! Pattern !! Sample Matches |
! MChar !! Definition !! style="width:15%"|Pattern !!style="width:25%"| Sample Matches |
||
|- |
|- |
||
| ^ || Start of a string. || ^abc || abc, abcdefg, abc123, ... |
| ^ || Start of a string. || ^abc || abc, abcdefg, abc123, ... |
||
Line 30: | Line 30: | ||
| + || 1 or more of previous expression. || ab+c || abc, abbc, abbbc, ... |
| + || 1 or more of previous expression. || ab+c || abc, abbc, abbbc, ... |
||
|- |
|- |
||
| ? || 0 or 1 of previous expression; also forces minimal matching when an expression might match several strings within a search string. || ab?c || ac, abc |
| ? || 0 or 1 of previous expression; also forces minimal matching when an expression might <br />match several strings within a search string. || ab?c || ac, abc |
||
|- |
|- |
||
| \ || Preceding one of the above, it makes it a literal instead of a special character. Preceding a special matching character, see below. || a\sc || a c |
| \ || Preceding one of the above, it makes it a literal instead of a special character. <br />Preceding a special matching character, see below. || a\sc || a c |
||
|} |
|} |
||