我正在尝试创建一个正则表达式来匹配所有字母或空格或具体数字。正则表达式来匹配任何字母,空格或具体数字
这是我的。
([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