Now that we are at this point, it is time for us to look at a few of the things that we are able to do when we want to write out a few codes in Python.
This is a great language to work with when we are beginners in Python, and we are not sure what steps we need to take and haven’t ever done any coding at all.
And that is why we are going to jump right in here and learn a bit more about how to do some of the codings that we need in this language.
The first thing that we are going to explore here is some of the basic patterns that are important when it comes to working with Python.
One thing that you will notice about the regular expressions that we will talk about in a bit is that you will not just be stuck working on a specific fixed character to make these work.
They can also be there to make sure that you are actively looking for the patterns that are needed.
Some of the most common of the regular expressions that we are able to work with here include:
- a, X, 9, < — ordinary characters just match themselves exactly.
The meta-characters that aren’t going to match themselves simply because they have a special meaning include: ^ $ *? { [] and more.
- . (the period) — this is going to match any single except the new line symbol of “\n
.”
- \w — this is the lowercase w that is going to match the “word” character.
This can be a letter, a digit, or an underscore.
Keep in mind that this is the mnemonic and that it is going to match a single word character rather than the whole word.
- \b — This is the boundary between a non-word and a word.
- \s — this is going to match a single white space character, including the form, form, tab, return, newline, and even space.
If you do \S, you are talking about any character that is not a white space.
- ^ = start, $ = end — these are going to match to the end or the start of your string.
- \t, \n, \r — these are going to stand for the tab, newline, and return.
- \d — this is the decimal digit for all numbers between 0 and 9.
Some of the older regex utilities will not support this, so be careful when using it.
- \ — this is going to inhibit how special the character is.
If you use this if you are uncertain about whether the character has some special meaning or not to ensure that it is treated just like another character.
These are just a few of the different expressions that are considered regular that work in the Python language and can show up in our code.
These are going to be important patterns that we are able to work with and learn about in this language, so we need to practice with them a bit on the IDLE editor that we already installed and get some practice with them.