找符号之间的文本,正则表达式? [英] Get text between symbols, regex?
本文介绍了找符号之间的文本,正则表达式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个问题,我不能想出一个办法脱身符号之间的文本。
I have a problem, i can't figure out a way to get out text between symbols.
site.com/hello-world/my-page-title/
我只想让我的页面标题?怎么样?
感谢您的帮助,
i want to get my-page-title only? How? Thanks for your help,
推荐答案
这正则表达式将会把我的页面标题第二组中:
This regex will put "my-page-title" in the second group:
^([^/]*/){2}([^/]*)/$
如果你总是希望在最后一组你可以使用:
If you always want the last group you can use:
^.*/([^/]*)/$
这篇关于找符号之间的文本,正则表达式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文