以下是使用PHP正则表达式捕获组的几个实例,表格中展示了正则表达式、待匹配的字符串以及匹配结果。

正则表达式待匹配的字符串匹配结果
/(""d{4})-(""d{2})-(""d{2})/2021-09-1520210915
/(""w+@""w+.""w+)/user@example.comuser@example.com
/(""d{3})-(""d{2})-(""d{4})/123-45-6789123456789
/(""d{2}:""d{2}:""d{2})/12:34:56123456
/(""w+)""s+(""w+)""s+(""w+)/helloworldexamplehelloworldexample