Changes

Jump to: navigation, search

Tutorial9: Regular Expressions

2 bytes added, 09:53, 8 July 2020
INVESTIGATION 3: OTHER COMMANDS THAT USE REGULAR EXPRESSIONS
# Type the following and press ENTER:<br><span style="color:blue;font-weight:bold;font-family:courier;">:%s/uli101/ULI101</span><br><br>You should have noticed that the first occurrence of uli101 has been changed to ULI101.<br><br>
# Navigate throughout the text file to see if the other occurrences have been replaced.<br><br>You should notice they haven't for the other two occurrences. In order to replace for ALL occurrences, you need to add the letter g (meaning "global") at the end of the last forward slash (e.g /'''search/replace/g''').<br><br>
# Making certain that you are command mode in vi, type the following and press ENTER:<br><span style="color:blue;font-weight:bold;font-family:courier;">:%s/uli101/ULI101/g</span><br><br>
# Navigate throughout the text file to confirm that ALL occurrences of uli101 have been replaced with ULI101.<br><br>
# Save changes to your vi editing session and exit by typing the following and pressing ENTER:<br><span style="color:blue;font-weight:bold;font-family:courier;">:wx</span>
13,420
edits

Navigation menu