正则表达式 - 以字符串开头和结尾 [英] Regular expression - starting and ending with a character string
本文介绍了正则表达式 - 以字符串开头和结尾的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想编写一个以字符串wp"开头并以字符串php"结尾的正则表达式来定位目录中的文件.我该怎么做?
I would like to write a regular expression that starts with the string "wp" and ends with the string "php" to locate a file in a directory. How do I do it?
示例文件:wp-comments-post.php
Example file: wp-comments-post.php
推荐答案
这应该可以为您解决^wp.*php$
匹配
wp-comments-post.php
wp.something.php
wp.php
不匹配
something-wp.php
wp.php.txt
这篇关于正则表达式 - 以字符串开头和结尾的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文