我正在嘗試創建一個正則表達式來匹配所有字母或空格或具體數字。正則表達式來匹配任何字母,空格或具體數字
這是我的。
([a-zA-Z\s24]*)
#but this is matching a 2 or a 4, i need exactly 24 only ex: - asdfafasf asfasdf #should match asdfafasf asfasdf - asdf asdf asdf 24 #should match asdf asdf asdf 24 - asdf24asdfasdf as #should match asdf24asdfasdf as - asdfadf2 asdf #should match asdfadf - asdfasdf kljl 6 #should match asdfasdf kljl
https://regex101.com/r/iNWuRb/1
它應該是:'([A-ZA-Z \ S] + | 24) ' – anubhava
嘗試使用'^(?: 24 | [a-zA-Z \ s])+' –
嘗試使用此網站。它可以幫助[正則表達式測試](https://regex101.com) – DaFois