Please enable JavaScript eh!

  Web Mechanic 

Bash Scripting

 Regex 101 

Here we're going to discuss what are known as a character classes, which is the most basic regex concept after a literal match.

Note: POSIX character classes can represent characters not in the English language.

A standard group known as POSIX Character Classes includes:

POSIX classes have to be entered as specified above - keyword bracketed by [: and :].

As in algebra, there may be different ways of specifying the same pattern:
12 + 13 + 9 may also be represented by 9 + 12 + 13

Constructing a regex also provides some operations, like the operations + - * and / do in mathematics:

That is quite a load to carry, so go slow and test your regex before implementing it in real life.

You can see now why it may be considered it's own language.

 Anchors 

Not only do we have a lot of control over how we tell a regex what to look for, we can also tell it where to look - either the beginning of the string or the end.

Two symbols you will see a lot of and use:

[^b]at matches all strings matched by .at except bat

[hc]at$ matches hat and 'cat but only at the end of the line