[英]Re in python to find a word in a string starting with a character? [on hold]
[英]python re string starting with
在以下字符串中,如何表示該行以數字開頭或以數字或多個結尾
line="He is a German called Mayer12345"
re.compile(r".*\d+\w$")
line="12He is a German called Mayer"
re.compile(r"^\d+\w .*")
只需使用 pipe,它是一個或用於正則表達式:
re.compile(r"(^\d+\w .*)|(.*\d+\w$)")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.