Changes

Jump to: navigation, search

ULI101 Week 9

65 bytes added, 20:33, 4 November 2018
Asterisk '*'
|}
== Asterisk '<code>*</code>' ==
Represents zero or more occurrences of regular expression directly preceeding the asterisk (<code>*</code>). By itself, it does not match anything - it is NOT a wildcard. It is used in conjunction with literal matches, a period or other special characters. Some examples of asterisk in regular expressions:
| Will match
|-
| <code>/cartcar*/</code>
| car, carpool, cart, caret
|-
|}
== Square brackets '<code>[]</code>' ==
Enclose a character class or group, similar to the shell. Any single character within the brackets will be matched. Hyphen can be used for defining a range of characters. Most special characters lose their special meaning. The caret sign at the beginning of the list means exclusion (<code>[^a]</code> means ''do not match a''). Some examples of square brackets in regular expressions are:
|}
== Dollar '<code>$</code>' ==
Matches strings at the end of the line, (anchoring matches to the end of the line). Examples of dollar in regular expressions are:
|}
== Grouping '<code>()</code>' and grouping with alteration '<code>(|)</code>' ==
Parentheses can be used to create bracketed regular expressions. The parentheses group the regular expression inside. The parentheses are not matched, only what is inside. Grouping offers alteration/choice represented by the pipe (|). When a grouped expression is followed by a quantifier such as the asterisk, the quantifier applies to the entire group Examples of grouping with and without alteration are:
<blockquote><code>grep</code> requires the <code>-E</code> option to enable grouping
</blockquote>
 
= Search and Replace in vi =
572
edits

Navigation menu