Exact match regular expressions for multiple equal signs

I am looking though a report that is automatically generated. There are many sections, and each section is separated by several "=" characters (equal signs). I want to create a simple script to basically retrieve specific data in a specific section. The only real definition of what a section is is based on the number of equal characters.

How can I find only "==" and not something else?

==== === == = 

I used some fresh regular expression before and based on my very limited knowledge, I could do this for normal characters, for example \ba{2}\b , however, trying to do this with \b={2}\b , he does not work.

By searching as ={2} , I can find all and all double equal signs.

What am I missing here? I can’t find much in this problem that I am facing.

+6
source share
1 answer

This simple regular expression matches only ==

 (?<!=)==(?!=) 

A negative lookbehind check is not there = earlier. A negative control checks to see if = after.

Regular expression visualization

+5
source

All Articles