regular expression with the same element twice without knowing it

226 Views Asked by At

I've plenty fill and want to find all of them which are like this:

A = A + B

So I wanna use a regular expression using M + x rgrep. and was thinking to something like that: ([A-Za-z][A-Za-z0-9]*) = () + [A-Za-z][A-Za-z0-9]* where () create a group which can be used latter.

Their is a way to make a regular expression where two item must be the same but without knowing the form of them?

1

There are 1 best solutions below

3
Avinash Raj On BEST ANSWER

I think you want something like this,

([A-Za-z][A-Za-z0-9]*) = \1 \+ [A-Za-z][A-Za-z0-9]*

DEMO