I'm trying to extract a pattern from string using python regex. But it is not working with the below pattern
headerRegex = re.compile(r'^[^ ]*\s+\d*')
mo = headerRegex.search(string)
return mo.group()
My requirment is regular expression that should start with anything except white space and followed by one or more whitespace then digits occurence one or more
Example
i/p: test 7895 => olp:7895(correct)
i/p: 8545 ==> Not matching
i/p: @#@# 3453 ==>3453
May I know what is missing in my regex to implement this requirement?
*s to+s.^\S+[^\S\r\n]+\d+$regex101.com/r/IEHGSe/1pattern=re.compile('\S+\s+\d+')re.match(pattern,string_to_be_matched)