0

WAP in python using regex to give all sequences of two lowercase letters joined by underscore

Input Aa_vccj_g Output a_v j_g Input a_b_c Output a_b b_c

16th Sep 2017, 5:34 PM
Harsh Prakash Agarwal
Harsh Prakash Agarwal - avatar
2 Antworten
18th Sep 2017, 9:49 AM
Vari93
Vari93 - avatar
+ 1
if still interested import re string= input () pattern = r"(?=([a-z]_[a-z])) out = re.findall(pattern, string) if out: print(out) PS. @Vari93 you code works, but it is not regex due to for loop. sorry.
19th Sep 2017, 1:09 PM
yuri