tags:

views:

26

answers:

1

Hi, I'm struggling to write a reg-ex that can do the following:

Label1.Caption := Edit1.Text;

Must return 2x results e.g.:

Label1.Caption
Edit1.Text

So its everything where its a word (Like "Label1"), a dot (.) and a given set of words like "Caption", "Text" etc.

+1  A: 
([\w.]+)\s*:=\s*([\w.]+)

This regex is more flexible than what you specified. Something like __hello...6 := oops will also pass. If you need the restrict to the Identifier.Identifier format,

([A-Za-z_]\w*\.[A-Za-z_]\w*)\s*:=\s*([A-Za-z_]\w*\.[A-Za-z_]\w*)
KennyTM
`<nitpick>` The second solution won’t work with identifiers starting with á, ä, å, ... `</nitpick>` ☺
Timwi
Thank you.... !!
Lennie