Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/271.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何消除结尾字符_Php_Regex_Preg Match All - Fatal编程技术网

Php 如何消除结尾字符

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的结尾都是” 谢谢你的帮助。我会使用:

我喜欢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的结尾都是

谢谢你的帮助。

我会使用:

~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
简单但有效。简单但有效。