我有这个字符串
9 月 1 日起可使用设备齐全的自助式 2 卧室套房,步行 5 分钟即可到达 UVIC。
现在我正在使用预匹配来提取它:这是正则表达式。
'/\bavailable\\s(?P<date_available>[?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)|Jul(?:y)?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?|immediately]+[\\s\d]+)[st|nd|rd|th]?/i'
目前这个正则表达式可以从一个字符串中提取:
Available september 1st.
Available September 2nd
available september 3rd
available september 4th
available sept 1
输出示例是:
Array
(
[0] => available September 1
[date_available] => September 1
[1] => September 1
)
但是当字符串为:
Available for september 1st.
Available in September 2nd
available since september 3rd
available at september 4th
任何人都可以帮我处理这个问题吗?谢谢