import re def process(text): result_a = re.findall(r'\d+\sTrillion',text) result_b = re.findall(r'[@#$%^&+=]*\d+[@#$%^&+=]*\d*\s[@#$%^&+=]*T[@#$%^&+=]*r[@#$%^&+=]*i[@#$%^&+=]*l[@#$%^&+=]*l[@#$%^&+=]*i[@#$%^&+=]*o[@#$%^&+=]*n[@#$%^&+=]*',text) if len(result_a)==0 and len(result_b)>0: print('raise error here beacause ',result_b) else: print(result_a) tests = ["2 4334 Rigid Tall 54 Trillion somr text","2 4334 Rigid Tall +54 Tri+llio@n somr text"] for test in tests: process(test)
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question