Riccardo Pedrielli
Riccardo Pedrielli

Reputation: 237

Reg Exp matching multiple instances

I have to match multiple instances of either "int(" or "der("

So the expression must match these strings

VVEH + int(ACC_X) + der(FL_WSP)
VVEH + int(ACC_X) + int(FL_WSP)
VVEH + der(ACC_X) + der(FL_WSP)

and not these

VVEH + int(ACC_X) + log(FL_WSP)
VVEH + der(ACC_X) + log(FL_WSP)

Upvotes: 0

Views: 107

Answers (1)

Buh Buh
Buh Buh

Reputation: 7546

VVEH( \+ (int|der)\([^)]+\)){2,}


VVEH            #Initial string
(
    \+          #Escape the 'plus'
    (int|der)   #Either of your function names
    \(          #Escape the bracket
    [^)]+       #Match anything inside the brackets
    \)          #Escape the bracket
){2,}           #All of that stuff above at least twice

Upvotes: 1

Related Questions