文件名的正则表达式模式 [英] Regex Pattern for a File Name

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

问题描述

如果文件名符合以下条件,用户可以将文件放入服务器:

A user can put a file in the server if the file name matches the following criteria:

它必须以 abc 开头,然后是一个点和一个数字.

It has to start with abc, then a dot, and a number.

Valid file names:

    abc.2344
    abc.111

Invalid:

    abcd.11
    abc.ab12

什么是正则表达式?我不能只使用 abc.*.

What would be the regex? I can't just use abc.*.

推荐答案

是这样的:

^abc\.\d+$

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

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