是否有任何正则表达式将检查MAC和Windows键盘的特殊字符 [英] Is there any regular expression which will check special characters for both MAC and Windows keyboard

查看:102
本文介绍了是否有任何正则表达式将检查MAC和Windows键盘的特殊字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,

我有一个文件。虽然使用Windows键盘重命名,但它不允许特殊字符,因为我正在使用正则表达式,但我使用Mac键重命名文件登上它允许特殊字符。我怎么能避免这个问题?是否有任何正则表达式可以检查MAC和Windows键盘中的特殊字符?请告诉我。用于验证Windows特殊字符的.Regular exp是

< pre lang =c#>< dxe:TextEditSettings MaskType = RegEx Mask = [^<> /?:* \\ |] { 1 100 } MaxLength = 100 MaskBeepOnError = True />





谢谢

Bikash

解决方案

这里是与字母数字和下划线相匹配的正则表达式

^ [a-zA-Z0-9 _] *





插入符号匹配字符串的开头

之间[]匹配字母和数字以及下划线

*表示0或更多


匹配字符串的结尾



你可以添加你想要的任何其他角色(但有些需要转义(点,圆括号,斜线和类似)。



你可以尝试^ \w *


HI,
I have a file.While renaming it using for windows key board ,it is not allowing special characters as i am using a regular expression,but while i renaming the file using Mac key board its allowing special characters. How could I avoid this issue?Is there any regular expression which ll check for special characters in both MAC and Windows key board?Please tell me.Regular exp that I used for validating Windows special charactes is

<dxe:TextEditSettings MaskType="RegEx" Mask="[^<>/?:*\\|"]{1,100}" MaxLength="100" MaskBeepOnError="True" />



Thanks
Bikash

解决方案

Here is regex that matches alphanumerics and underscore
"^[a-zA-Z0-9_]*


"

caret matches start of the string
thing between [] matches letters and numbers and underscore
* says 0 or more


matches end of the string

You can add any other character you want (but some need escaping (dots, parentheses, slashes and similar).

You could try "^\w*


这篇关于是否有任何正则表达式将检查MAC和Windows键盘的特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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