You can match a word by putting it between two brackets.
As example, this will only match the word "Dinosaur": (Dinosaur)
Using ?: after opening parenthesis of a capturing group creates a non-capturing group. Useful for example with template function reFindAllSubmatches.
This will not sub-match the words "red, blue, green":
{{ reFindAllSubmatches `(?:color=)(red|blue|green)` "color=red beautiful" }}
To clarify more - it will not show dateid, because it's a whole match:
{{ slice (index (reFindAllSubmatches `(?:dateid=)([0-9]{5})` "dateid=12345") 0) 1 }}
You may also want to catch multiple options, for that we use a "Vertical bar" or also known as a "Pipe" between linux users.
As example, this will match if either "Cat" or "Dog" is present: (Cat|Dog)
To match anything of any length, use .*.
Character classes
To match a word, you put it between two brackets.
Example: (Banana)
For matching characters there are multiple options:
Matching specific characters:
For matching a specific character, you put them in square brackets.
This will match A, B and C: ([abc])
This will match every character from A-z: ([A-z])
This will match every number: ([0-9])
Sometimes you have to use special characters but it may cause conflicts. In this case, you will have to use an escape character.
For example, this is a star that doesn't interfere with other matches \*.
Understanding Regex
If you still do not know what Regex are or want to know more. Check out the cheat sheet on the site below.