Regular expression - starting and ending with a character string

后端 未结 3 426
梦如初夏
梦如初夏 2020-11-27 03:03

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?

Examp

3条回答
  •  悲&欢浪女
    2020-11-27 03:36

    This should do it for you ^wp.*php$

    Matches

    wp-comments-post.php
    wp.something.php
    wp.php
    

    Doesn't match

    something-wp.php
    wp.php.txt
    

提交回复
热议问题