浜虹敓鑻︾煭锛屾垜鐢╬ython
#coding=utf-8
import re
line = "aooooaay123"
reg_str = ".*(a.*a).*"
match_obj = re.match(reg_str,line)
if match_obj:
print(match_obj.group(1))
杈撳嚭缁撴灉aa
涓轰粈涔堟槸aa鑰屼笉鏄痑ooooa鍛
鎴戞槸杩欐牱瀛愮悊瑙g殑锛屾鍒欓氬父鐨勮涓烘槸灏藉彲鑳藉鐨勫尮閰嶏紝鎵浠ュ湪
.*
鐨勬椂鍊欎粬鍙互鍖归厤鍒癮ooooa锛屾墍浠ラ噷闈㈢殑鎷彿鎵嶄細鍖归厤鍒癮a
鎷彿鐨勬剰鎬濇槸瀛愰泦
鎵浠ュ鏋滄垜鎯冲尮閰嶅埌aooooa鐨勮瘽鎴戝氨搴旇灏唋ine鏀逛负
reg_str = ".*?(a.*?a).*"
?鍙风殑鎰忔濇槸鎳掓儼妯″紡 灏藉彲鑳藉尮閰嶅皯涓鐐
杈撳嚭缁撴灉鎵嶆槸aooooa
鍙戣〃鍥炲