Double-testing with lookahead assertions


show more Double-testing with 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 ...

Double-testing with lookahead assertions

In the previous movie, we learned about the basics of positive lookahead assertions. In this movie, I'd like us to revisit some of the examples that we just saw. So, we saw that we could have a lookahead assertion for seashore, followed immediately by another expression: S, E, A, and that would match sea in seashore, but not in seaside. Then we saw that that's the same thing as if we had S, E, A as an expression, followed by a lookahead assertion for shore. So why use one over the other? Both of these would match the exact same text.

However, there are two important differences that I want us to notice. The first is the order in which the expressions are executed. In the first example, it attempts our assertion before it attempts to match S, E, A. In the second example, it tries to match S, E, A before it matches our assertion. That order can make a big difference if you are trying to optimize your regular expressions for speed and efficiency. So you will want to keep that in mind, a...

Double-testing with lookahead assertions
Video duration: 7m 16s 5h 36m Intermediate

Viewers:

Double-testing with 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 ...