In this lesson, we're going to start our module on regular expressions. A regular expression is a set of characters, either specifically or in a range that can be searched for in any type of textual document. So what does that mean? Well, if, for example, I was using the grep command, and I wanted to find every occurrence of the word and in a file, I would at the command prompt, type grep and, and then somefile. And what this would do is it would go through somefile, and pull out every occurrence of the letters A-N-D being side by side in lowercase. A-N-D within the single quotations or text is the very simplest of regular expressions. But this would be considered a character set. Now, if, for example, I wanted to find A-N-D and I don't care if something follows it, then I would add an asterisk. So now I have and* somefile. And this would produce any time A-N-D occurred together with at least one other character after it, and it can be a repeating character or another character. We're kind of used to seeing this because this is very much like the Microsoft wildcard. Now, what if we needed to find the word and but we didn't know how to spell it? We can use the dot operator. So for example, I can type grep, and we'll say that I know and starts with an A, but there's a letter in the middle and I'm just not sure that it is. So I will put a period or a dot there, and then I will follow it with a D because I know that there's a D in there. After I type in the search, I need to make sure I type in somefile. And somefile really, it represents any file you need to search through. This will go through the file and produce instances of the letter A with one character, followed by the letter D. Now, if I knew that there was one character after the D, I could just go in and put that. That will produce A, any letter, D, any letter. But it will not produce and. The reason is is once I put the dot in, there must be a character there. A couple other special characters we need to be aware of are the caret, which is Shift + 6 and the dollar sign, which is Shift + 4. The caret locates anything as long as it occurs at the beginning of a line. So if I had grep and then I had caret and to somefile, it will look in somefile and pull out every occurrence of and where A is the first character of the line. Conversely, if I would do exactly the same thing, only I would use a dollar sign, so my search would be and dollar sign, then it's going to produce for me every occurrence of and that occurs at the end of a line. Also, if you create a regular expression where you combine the caret and the dollar sign, this will search and produce every instance of a blank line in that document. In our next lesson, we're going to talk about how to format a regular expression. See ya then.