Negative lookahead assertions


show more Negative lookahead assertions provides you with in-depth training on Developer. Taught by Kevin Skoglund as part of the Using Regular Expressions show less
please wait ...

Negative lookahead assertions

So far, we've been talking about positive lookahead assertions, but they have an opposite, which are negative lookahead assertions, and the metacharacters we use for negative lookahead assertions are the question mark, followed by the exclamation point. The way we use them is the same way that we use the positive ones. Inside a grouped expression, the very first character inside the parentheses should be a question mark, then an exclamation point, and then our regular expression. The question mark indicates that this grouped expression has a different meaning than normal, and the exclamation point means that, that meaning is negative, or not equal. The exclamation point makes sense, because in many programming languages, exclamation point is used to mean not.

So if we had an exclamation point, followed by an equal sign, it would be used to mean not equal. Well here, we are just using the exclamation point by itself to mean negative; not this regular expression. Be careful that there is...

Negative lookahead assertions
Video duration: 6m 11s 5h 36m Intermediate

Viewers:

Negative lookahead assertions provides you with in-depth training on Developer. Taught by Kevin Skoglund as part of the Using Regular Expressions

Subject:
Developer
Software:
Regular Expressions
Author:
please wait ...