DistributedNetworks DistributedNetworks

Regular Expressions   «Prev 

Using ., *, and [ ] in regular expressions

In this command, the regular expression matches a pattern of five characters, the "s.tte"
The dot (.) means any character can occur in the second position.

The * matches zero or more characters preceding it.
Hence, this regular expression finds patterns that do not necessarily begin with the letter "s".

By adding the dot(.), this expression will match the letter s, followed by zero or more characters, followed by zzle.
This time, only two lines match, sizzle and swizzle.

This expression uses [] to match a character range, uppercase A to H. The full expression matches all lines that contain VA, VB, VC, and so on through VH, anywhere in the line.

Without quotes, the [] is expanded by the shell, resulting in arguments VA, VB, VC, and so on. The first agrument, VA, is treated as a pattern, but the remaining ones are treated as file names.