Extract Text using RegTex


Id like to create a RegEX to extract the left text until the first “)” character.

For example:

In the list below:

Interface ClientA(CLIENTA): Bits received
Interface ClientB(CLIENTB): Bits received
Interface ClientC(CLIENTC): Bits received
Interface ClientD(CLIENTD): Bits received

Id like to extract only the list below using RegEX. And I cannot use “:” as delimeter:

Interface ClientA(CLIENTA)
Interface ClientA(CLIENTB)
Interface ClientA(CLIENTC)
Interface ClientA(CLIENTD)

Could someone help me ,please?



Hi @estatica ,

Regular expressions are quite flexible, so there are many different ways to capture this substring. I would play around with regex101.com. Here is one solution that uses several metacharacters and a positive lookahead assertion.

keep in mind that this regular expression assumes that each line starts with Interface. If that’s not the case, then we’ll have to adjust things.


Thanks Matt

Ill try this.