请帮助我建立正则表达式 [英] Please help me to build regular expression

查看:87
本文介绍了请帮助我建立正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要匹配某些模式,请帮助

I want to match certain pattern Please help

website1/somestring/
website1/somestring/default.htm
website/somestring


但我需要排除


but i need to exclude

website/xyz


xyz =我要排除的特定字符串


xyz = particular string which i want to exclude

website1/somestring/anything 


从斜线上方的行开始,我只允许default.htm或空格
除此以外,我要排除的其他任何内容

我尝试使用下面的行


from above line after slash i want to allow only default.htm or space
anything other than this i want to exclude

i tried with below line

/website1/(.*)/[^*\S]*$


但不适用于所有组合
请帮助


but not working for all combination
please help

推荐答案


但不适用于所有组合
请帮助


but not working for all combination
please help


我会在此处 [
I''d start here[^]: they may have something close to what you want that you can adapt.


我想要字符串带有/后跟无内容
例如:
website1/abc/


带有/的字符串,后跟默认值.htm
例如:
website1/abc/default.htm

两者都应该工作

非常感谢
i want string with / followed by nothing
example:
website1/abc/

and
string with / followed by default.htm
example:
website1/abc/default.htm

both should work

many thanks


这篇关于请帮助我建立正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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