Is it possible to define a part of the pattern once then perhaps name it so that it can be reused multiple times inside the main pattern without having to write it out again?
To paint a picture, my pattern looks similar to this (pseudo regex pattern)
(PAT),(PAT), ... ,(PAT)
Where PAT
is some lengthy pattern.
Requirements
- Not have to repeat the pattern because it's length becomes a problem (currently, Notepad++ only allows 2047 characters in the search box when using regex and I'm easily going over this limit)
- Each capturing group should be able to match independently of its siblings. For example, say that my pattern is
([a-z]),([a-z]),([a-z])
thena,a,a
anda,b,c
should match
I've looked into naming the first capturing group then referencing it in the subsequent capturing groups but this method breaks the second requirement (i.e., it fails to match a,b,c
). Is there a direct or indirect way of fulfilling both requirements using regex only?
My end goal is to be able to get and access the value of each capturing group so I can manipulate each group later in the "replace" part of the search & replace box.