简体   繁体   中英

regular expression with the same element twice without knowing it

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?

I think you want something like this,

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

DEMO

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM