Notepad++ attempting to find specific text within brackets
-
Hello,
I am attempting a search with Notepad++
I am trying to find all lines that include finished and LOGN_LEVEL_1[-1]
sample line below02:20:11.054|gis.dovv |lert |overout.lsp |0105|"unearthing du upon finished: DUPIL[2180500000001874] GLYY[1743142790.88] bred[ %%%%%% ] predi[12234143] NUTS[1573.51] LOGN_LEVEL_1[-1] MOTOR[1] "
I have tried
(?i-s)^(?=.*finished)(?=.*LOGN_LEVEL_1[-1] ).+
but dosen’t seem to find.
Seems to me that there is something about the “[-1]”
Thanks—
moderator added code markdown around text; please don’t forget to use the
</>
button to mark example text as “code” so that characters don’t get changed by the forum -
-
-
@cs-Davis said in Notepad++ attempting to find specific text within brackets:
Seems to me that there is something about the “[-1]”
Yep. You need to escape the square brackets, e.g.
\[-1\]
-
@cs-Davis said in Notepad++ attempting to find specific text within brackets:
Seems to me that there is something about the “[-1]
They are special, we call them meta-characters. There is a reference here . meta-characters need the escape character to make them “literal”. More reading about how to write regular expressions likely needed.
Terry
-
@Alan-Kilborn
Thanks Alan,
I did try(?i-s)^(?=.*finished)(?=.*ATRI_LEVEL_1 \[-1\] ).+
might you see anything else that I might be missing?
Thanks for your suggestion—
moderator added code markdown around text; please don’t forget to use the
</>
button to mark example text as “code” so that characters don’t get changed by the forum -
@cs-Davis said in Notepad++ attempting to find specific text within brackets:
might you see anything else that I might be missing?
In the first instance, why not load your expression and example data in regex101.com . Make sure the flavour of regular expression is PCRE, because the Boost regular expression engine (which Notepad++ uses) relates most closely with that, see this FAQ post.
Beyond that there is this FAQ post which has lots of links for support of regular expressions (all flavours).
Terry
-
@cs-Davis said in Notepad++ attempting to find specific text within brackets:
(?i-s)^(?=.*finished)(?=.*ATRI_LEVEL_1 \[-1\] ).+
might you see anything else that I might be missing?
Well, in the post, it looks like you typo’d ATRI for LOGN, but you probably didn’t do that in your test.
However, unless this is also a typo, the space between _1 and \[ would be interpreted as something that has to match; if, as in your sample data, there is no space, there can’t be one in your pattern, either.
-
@Coises
Thanks much Coises, dang too easy to overlook a simple space, its almost like trying to figure out a sound problem when it was the mute button that was hit.
Thanks again