duncanportelli
duncanportelli

Reputation: 3229

Notepad ++ RegEx Repetition Syntax

Imagine I have a word 'bananananas'. What would be the RegEx repetition syntax to find this word:

So far, I tried ba(na){4}s, but it yielded no results. What is the correct syntax to do so please?

Upvotes: 1

Views: 1515

Answers (1)

BoltClock
BoltClock

Reputation: 723598

As mentioned in my comment, your regex will only work in Notepad++ starting from version 6, which supports PCRE and thus supports numeric quantifiers. Previous versions will spit an error.

If you're using an older version and for some reason cannot upgrade, you won't be able to use that syntax. You'll have to put up with something like ba(na)+s instead, which matches na repeated as many times as until it reaches s.

Upvotes: 7

Related Questions