js使用正则获取当前页面url指定参数

js使用正则获取当前页面url指定参数,第1张

网址: >

我给你一个php语言的例子,你看看吧

<php

$s='aaa-bbb-ccc/ddd-eee/abc';

$regex='/^(([A-Za-z]+\-)[A-Za-z]+\/)([A-Za-z]+\-)[A-Za-z]+$/';

if(preg_match($regex,$s)){

echo "文件路径格式正确!";

}else{

echo "文件路径格式错误!";

}

>

<php

$test = '<p>444<img height="768" width="1024" alt="" src="/uploadfiles/28/Treejpg" /></p>

<p>444<img height="768" width="1024" alt="" src="/uploadfiles/sf/Treejpg" /></p>

fsdafasdfasdfasdf

<p>444<img height="768" width="1024" alt="" src="/uploadfiles/28/elmjpg" /></p>

sdfasdfasdf<p>

<p>444<img height="768" width="1024" alt="" src="/uploadfiles/28/maplejpg" /></p>

sdf32414撒旦发是否

<p>444<img height="768" width="1024" alt="" src="/uploadfiles/40/Treejpg" /></p>';

preg_match_all("/<p>src=\"([^^])\"<\/p>/i",$test,$match);

print_r($match[1]);

>

这样应该可以,我试的多行的,中间还夹杂一些字符,没什么问题,呵呵

是文件名还是加上>

以上就是关于js使用正则获取当前页面url指定参数全部的内容,包括:js使用正则获取当前页面url指定参数、怎么使用正则匹配一个文件路径'aaa-bbb/aaaccc-bbbbd'是否合法求大佬解答!!!、求php中正则表达式从html代码中获取图片路径等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/9759970.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-01
下一篇2023-05-01

发表评论

登录后才能评论

评论列表(0条)

    保存