姝e垯琛ㄨ揪寮-璐┆涓庢噿鎯 python绡

浜虹敓鑻︾煭锛屾垜鐢╬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

All posts

Other pages

鍙戣〃璇勮

鐢靛瓙閭欢鍦板潃涓嶄細琚叕寮銆 蹇呭~椤瑰凡鐢*鏍囨敞