Number_Plate = input ("Number Plate of car :")
Validation = re.match("([a-zA-Z]{2}[0-9][Whitespace][A-Za-z]{3})",Number_Plate)
我的問題是如何爲re.match
添加一個空白來檢查?在Python中,如何將空白添加到RegEx模式?
Number_Plate = input ("Number Plate of car :")
Validation = re.match("([a-zA-Z]{2}[0-9][Whitespace][A-Za-z]{3})",Number_Plate)
我的問題是如何爲re.match
添加一個空白來檢查?在Python中,如何將空白添加到RegEx模式?
用'\ s'?你有沒有考慮實際閱讀正則表達式的語法? – jonrsharpe
這是一篇關於正則表達式中空格的好文章。你甚至可以嘗試你自己的正則表達式(解決方案在頁面底部)。考慮在詢問特定模式之前習慣使用正則表達式。 –
關於RegEx(正則表達式)的更多信息[here](http://regexr.com)(請務必查看cheatsheet並使用測試儀) – x13