In the following string how to say that the line is starting with a digit or ending with a number or many
line="He is a German called Mayer12345"
re.compile(r".*\d+\w$")
line="12He is a German called Mayer"
re.compile(r"^\d+\w .*")
Just use the pipe, it's an or for regexes:
re.compile(r"(^\d+\w .*)|(.*\d+\w$)")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.