help needed with regular expression please

Soldato
Joined
18 Oct 2002
Posts
9,804
Location
Southampton, Hampshire
being a n00b when it comes to reqular expressions I could do with some help when it comes to conditional string replacement/deletion.

i'm trying to match a string with a word in the middle that could vary. if there is a match then i'd like to remove the end bit after the varying word.

i.e.
msg.setEventType(EventType.OPEN_DOOR.toString()
the text in green is the varying string. i can match it using:
Code:
(setEventType\()(EventType\.).*(toString\(\))

the text in orange is what i'd like to remove.

however my problem comes when it comes to removing the toString() bit - I'm not sure how to do it so that I also keep the text in green.

can anyone help please?

thanks in advance! :)
 
Last edited:
Back
Top Bottom