Learn Java Programming - Regex Capturing Groups Introduction Tutorial

Pubblicato il: 06 febbraio 2016
sul canale di: Daniel Ross
3,253
27

Capturing Groups are built by enclosing regular expressions inside of a pair of parenthesis. A simple example of a capturing group would be a regex string literal enclosed in parenthesis like this: "(Lizard)". On the surface regex capturing groups appear to be very similar to plain old regex string literals, and the example above will actually be functionally identical. When Capturing groups are used in complicated expressions such as "(([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.){3}([01]?\\d\\d?|2[0-4]\\d|25[0-5])", they not only make the expression more readable, but they group regular expressions into things known as tokens.

Many operations can be performed on capturing groups. Capturing groups are automatically numbered, they can be assigned a name or alias, and they can be used as backreferences. This tutorial will not discuss the topics of capturing group numbering, naming, or backreferencing. The purpose of this tutorial is to simply demonstrate a basic usage of capturing groups so that I can introduce you to quantifiers in my next tutorial. Once I have discussed quantifiers and some other stuff, I will return to the topics of capturing group numbering, naming, and backreferencing so I can demonstrate more meaningful usage examples. This tutorial builds on concepts from my other regex tutorials so I highly recommend watching them all before continuing.


In questa pagina del sito puoi guardare il video online Learn Java Programming - Regex Capturing Groups Introduction Tutorial della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Daniel Ross 06 febbraio 2016, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 3,253 volte e gli è piaciuto 27 spettatori. Buona visione!