如何使用正则表达式javascript隔离和恢复查询中的单词? [英] How to isolate and recover a word in a query using regex javascript ?

查看:100
本文介绍了如何使用正则表达式javascript隔离和恢复查询中的单词?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

示例:



我有疑问:

Example :

I have a query :

?keyword=word&personcapacity=2



我需要通过删除来恢复此字?keyword =和& personcapacity = 2



但这个词会根据搜索结果而变化



你觉得吗?可以使用JS中的正则表达式吗?



我尝试过:



我尝试了这个但它不起作用:




I need to recover this "word" by deleting ?keyword= and &personcapacity=2

but this word changes depending on the search performed

Do you think that a Regex in JS can be used ?

What I have tried:

I tried this but it does not work :

^[\?-z]{8}[\s-z]{8}

推荐答案

谷歌阅读查询字符串params javascript,你会发现很多解决方案



使用JavaScript获取查询字符串参数 [ ^ ]
Google "read query string params javascript" and you'll find lots of solutions for this

Get Query String Parameters with JavaScript[^]


这篇关于如何使用正则表达式javascript隔离和恢复查询中的单词?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆