Php 如何消除结尾字符
我喜欢preg\u mach\u all命令,但现在我遇到了这种情况:Php 如何消除结尾字符,php,regex,preg-match-all,Php,Regex,Preg Match All,我喜欢preg\u mach\u all命令,但现在我遇到了这种情况: $lotes_fil='/((?:https?|http?):\/\/(?:\S*?\.\S*?)(?:[\s)\[\]{};"\'<]|\.\s|$))/'; preg_match_all($lotes_fil,$rs,$link_pre, PREG_SET_ORDER); 我需要删除最后一个“,但我想使用这个正则表达式,因为它对我很有用。在原始数据中,每个URL的结尾都是” 谢谢你的帮助。我会使用:
$lotes_fil='/((?:https?|http?):\/\/(?:\S*?\.\S*?)(?:[\s)\[\]{};"\'<]|\.\s|$))/';
preg_match_all($lotes_fil,$rs,$link_pre, PREG_SET_ORDER);
我需要删除最后一个“,但我想使用这个正则表达式,因为它对我很有用。在原始数据中,每个URL的结尾都是”
谢谢你的帮助。我会使用:
~https?://[^\s"]+~
说明:
~ # regex delimiter, it allows to use / without escaping
https? # http OR https
:// # literally
[^\s"]+ # 1 or more any character that is not a space or double quote
我会使用:
~https?://[^\s"]+~
说明:
~ # regex delimiter, it allows to use / without escaping
https? # http OR https
:// # literally
[^\s"]+ # 1 or more any character that is not a space or double quote
简单但有效。简单但有效。