Backreferences


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

Backreferences

In this chapter, we'll learn about capturing groups, and how to use backreferences to access those groups. If you remember back in Chapter 5 when we talked about grouping expressions by using parentheses, I mentioned that grouped expressions are captured by the regex engine. What this means is that as the regex engine is going through and finding matches, it stores the matched portion that's in parentheses. It bookmarks it, and remembers it for later. So for example, let's say we have a regex like A, open parentheses, P, and then the two quantifier after it, L, close parentheses, E.

Well, we already know, obviously, that's going to match apple, but at the same time that it's matching it, the regex engine also says, ah! Inside those parentheses, it matched P, P, L. I am going to store that, and remember it for later. Notice it stores the actual data that was matched; not the expression. So the actual match that it made, it stores that data from the string, so we can h...

Backreferences
Video duration: 8m 57s 5h 36m Intermediate

Viewers:

Backreferences 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 ...