Issue
I am having trouble matching lines with nothing but repeating equals signs (=) in Notepad++. I'm searching a plain text document for any line that begins with "=" and ends with "=". For instance, all these should match my regex:
========================
==================
==
=================================================
, etc.
My code
This is my regex:
^(=*)$
Not only does the regex not find equals signs, it falsely finds blank lines instead.
Rationale
^
= line begins with an equals sign.
=*
= find any sequence of one or more equals signs
$
= line ends with an equals sign
But my regex doesn't work. There must be some strange exception in Notepad++ because I verified that equals signs don't have to be escaped in JavaScript and my regex works fine at this online regex tester:
Links I've found that haven't been fruitful
- regex matching expression notepad++
- Difficulties with adding spaces around equal signs using regular expressions with Notepad++
- http://docs.notepad-plus-plus.org/index.php/Regular_Expressions
- https://www.icewarp.com/support/online_help/203030104.htm
My questions
Why is my regex only returning blank lines?
If my regex is wrong, please explain why and what the correct regex is to do my find. Eventually I will do a replace as well, but I didn't want to cloud the issue.
Feedback on proposed duplicate
It was suggested that this post might be a duplicate of this question. This post is not a duplicate, and here is why:
Even if the content of the two posts were similar:
For a user to find the suggested post with "plus vs. star" in the title would suggest that he/she already had some idea what the problem was (i.e., use "plus" instead of "star").
Anyone else having this problem and being in my same predicament wouldn't necessarily know that plus vs star was the issue.
If the suggested post had come up as a possible answer when I searched "equals sign regex not working notepad++", I wouldn't have had to take my time to write this post.