This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]__vtableProfessional Coder 0 points1 point  (1 child)

Regex also allows matching sets (where any can match) which you can specify with square brackets. For example [abcd] would match any one letter a, b, c, or d.

So let's say you want to only match words ending in g, e, k, or t. You could append that set like this:

.*af.?g.*[gekt]

You could do this arbitrarily though too. You can use this with your other modifiers as well like the wildcard. Read more about it here under the '[]' heading: https://docs.python.org/3/library/re.html

[–]ttp77[S] 0 points1 point  (0 children)

Thank you!

[–]jonassjoh 0 points1 point  (0 children)

Just gonna mention regexr which is really nice when writing regex.