Find Lines starting with #
-
To all,
I’m following the examples online but am having no luck finding lines that start with #.
Here is a sample line:
# post:I have thousands of lines I want to find and remove.
I’m using Notepad++ 8.4.5.
Can someone help me with a working example of how to find and mark lines start with #? I’ve tried all sorts of variations of ^#, ^[#], ^[#].* but nothing is finding the lines.
Thanks very much in advance,
EC -
@Eric-Cox Did you check Regular Expression?
-
Yes, I have the Mark and Find exactly as you show but it doesn’t find any matches in the source file.
The Regular Expression radio button is selected and the Find what: ^# is exactly as you show. I’m not sure what I’m doing wrong.
-
I see what might be the problem.
POST:
Notice the # is not the first character on the line. It is the third character.
Refining my Find: I need to find all lines where the first character is # regardless of empty blank spaces before the #.
-
It looks like the unquoted # is markup in the web site.
" # POST:"
-
@Eric-Cox said in Find Lines starting with #:
It looks like the unquoted # is markup in the web site.
This could have been avoided if you’d noticed the FAQ.
-
@Eric-Cox said in Find Lines starting with #:
I need to find all lines where the first character is # regardless of empty blank spaces before the #
Find:
^\h*#
But I’m sure the purists reading this won’t like that, so this is really more of exactly what you asked for:
Find:
^\x20*#
BTW, thanks for clarifying your questions by posting additional times rather than editing older posts. Doing it the way you did makes it SO much clearer how your question evolved.
-
That worked. You are the best!!!