开发者

Get Groups From Words

开发者 https://www.devze.com 2023-01-14 05:39 出处:网络
I\'m struggling to write a reg-ex that can do the following: Label1.Caption := Edit1.Text; Must return 2x results e.g.:

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 "La开发者_开发百科bel1"), a dot (.) and a given set of words like "Caption", "Text" etc.


([\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*)
0

精彩评论

暂无评论...
验证码 换一张
取 消