regex - Python Regular expression matching integer after a tab -
how can match integer written after tab? regular expression that?
i have tried this:
line = '0 1' re.match('\t+\d',line) but not work - 1 not matched.
i want 1 matched , returned.
the reason regex failing tab 4 spaces. if string more complex example, can use \s+ match 1 or more whitespace characters ( of [ \t\n\r\f\v]):
import re line = "0 1" print re.findall("\s+(\d+)", line) which prints
['1'] if string isn't more complex example, can use vks' solution , match digits ("\d+$").
Comments
Post a Comment