From the course: Learning Regular Expressions
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Quantified repetition - Regular Expressions Tutorial
From the course: Learning Regular Expressions
Quantified repetition
- Now that we've learned about repetition meta characters, we should also talk about quantified repetition. The previous meta characters can be repeated either zero times, one time, or an infinite number of times. But if we want something that's more specific, something that's a specific quantity, let's say we want to repeat something exactly four times. Or we want to repeat it four, five, or six times, but not anything else. That's where quantified repetition comes in. We have the ability to specify the number of times something's repeated. And we do that by using curly braces with some values inside, that indicates quantified repetition. So the previous item will be repeated a certain number of times. The values that we put in between those curly braces would represent the minimum time it can be repeated, and the maximum time. You would do it with a minimum, comma, and the maximum. Min and max are always going to be…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.