regex - regular expression to find a number after a substring in python -


i have string:

string = "tic_signal_12 ((task)(0))" 

by using regular expressions, want number after "(task)" substring not know how build expression

use \d* match non-digit chars.

>>> import re >>> string = "tic_signal_12 ((task)(0))" >>> re.search(r'\(task\)\d*(\d+)', string).group(1) '0' 

Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -