I'm trying to search a document for data on a specific column. I am trying to use:
^.{x}[data to find]
where x is the number of columns I want - 1.
I'm not sure if I am doing something wrong, or if my regex engine does not support that syntax. I am trying to use Notepad++, if that is helpful.
Update 2013-2014 (4-5 years later)
As mentioned by Alan Moore in the comments
Notepad++ v6.x has real regex support via the PCRE library
See "How to use regular expressions in Notepad++ (tutorial)" (Multiplying operators)
Original answer (February 2009)
I just checked with the latest Notepad++5.2 and its regexp feature.
I confirm it does not have any repetition operator {min,max}
which would have allowed you to specify how many times a token can be repeated.
An alternative would be:
.... [repeat '.' as many time as the number of column you want] ...[data to find]
You do not need ^
: by default, Notepad++ regexps are applied line-by-line, and the .
does not match eol characters (\r
or \n
)
As Asmor mentions in the comments:
Notepad++, for all its great features, uses Scintilla and inherits Scintilla's regex processing, with its limited regex features.
You say that "by default" regexes are applied line by line. This implies that you can set it otherwise, but to the best of my knowledge (and please, I beg you, prove me wrong!), there's no way to make multi-line regexes.
(I agree, and that is a major limitation)
Another limitation of Scintilla, the
^
operator is actually important, as it anchors the regex to the beginning of the line. Say you wanted to match 3 in the third column. You would want^..3
, and..3
would match3
in any column past the second.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With