Python progamming。私が欲しいものPython:最初に一致するパターンを一致させる方法
abc_clk] -to [all_registers -clock xyz_clk -data_pins
がabc_clk
次のとおりです。私は私のようにy.group(3)
を得た
y = re.match(r'(.*)(get_clocks)\s+(.*)(\])(.*)$', x, re.M|re.I)
を使用する場合
x = "set_ccci_path 2 -setup -from [get_clocks abc_clk] -to [all_registers -clock xyz_clk -data_pins] -start"
: のPython 2.4.3
は、私は、文字列を持っています。これはどうすればいいですか?
y = re.match(r'(.*)\[((get_clocks)(\s+)(?P<c>\w+))\](.*)$', x, re.M|re.I)
y.group('c')
Y = re.match(R '(*)(get_clocks)\ S +(*)(\])(*)$。。。'、X、re.M | re.I) –