Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Regular Expressions in Python!
You have completed Regular Expressions in Python!
Preview
Negated sets let us specify characters and sequences that should be left out of any matches.
New terms
-
[^abc]- a set that will not match, and exclude, the letters 'a', 'b', and 'c'. -
re.IGNORECASEorre.I- flag to make a search case-insensitive.re.match('A', 'apple', re.I)would find the 'a' in 'apple'. -
re.VERBOSEorre.X- flag that allows regular expressions to span multiple lines and contain (ignored) whitespace and comments.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
Let's comment these two both out, and
let's take our email address one.
0:00
And I wanna match all the email address,
just like we did before.
0:07
But if the email undress ends in .gov, I
want to leave that part off.
0:10
Just pretend I have a good reason for this
cuz I, I really don't.
0:16
So, all right, this sounds like a really
good place for us to use a negative set.
0:21
And we can also write this out.
0:26
I mean, this is really, there's a lot to
this.
0:28
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up