We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Re.findall() & Re.finditer()
Re.findall() & Re.finditer()
+ 0 comments import re k = [] for i in re.finditer(r'(?<=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])([aeiouAEIOU]{2,})(?=[QWRTYPSDFGHJKLZXCVBNMqwrtypsdfghjklzxcvbnm])', input()): print(i.group()) k.append(i.group()) if k == []: print(-1)
+ 0 comments import re S = input() p = r'(?<=[bcdfghjklmnpqrstvwxtyzBCDFGHKLMNPQRSTVWXYZ])([aeiouAEIOU]{2,})(?=[bcdfghjklmnpqrstvwxtyzBCDFGHKLMNPQRSTVWXYZ])' if re.findall(p,S): print(*re.findall(p,S), sep = "\n") else : print(-1)
+ 0 comments import re pattern= re.compile(r'(?<=[qwrtypsdfghjklzxcvbnm])[aeiou]{2,}(?=[qwrtypsdfghjklzxcvbnm])',re.IGNORECASE) matches= re.findall(pattern, input()) [print(*matches,sep="\n") if matches else print(-1)]
+ 0 comments The pattern in lookbehind and lookaheads exclude consonants, whitespace, digits, non-slphanumeric and underscore.
import re pattern = '(?<=[^aeiou\s\d\W_])([aeiou]{2,})(?=[^aeiou\s\d\W_])' lst = re.findall(rf'{pattern}', input(), re.IGNORECASE) if lst: print(*lst, sep='\n') else: print(-1)
+ 0 comments import re pattern = re.compile(r"(?<=[qwrtypsdfghjklzxcvbnm])([aeiou]{2,})(?=[qwrtypsdfghjklzxcvbnm])", re.I) m = re.findall(pattern,input()) if m: print("\n".join(m)) else: print(-1)
Load more conversations
Sort 324 Discussions, By:
Please Login in order to post a comment