问题描述
我正在寻找符合以下条件的正则表达式:sometext \ sometext
文本可以包含小写,大写,数字或特殊字符
例如:demo-dir \ abc123
我已经尝试过以下方法:^ [a-zA-Z0-9 _.-] \\ {1,20} $
但不完全适合.
在此先感谢
Hi,
I''m looking for regular expression that match:sometext \ sometext
text may contain lowercase,uppercase,numbers or special characters
ex:demo-dir\abc123
I''ve tried with this one: ^[a-zA-Z0-9_.-]\\{1,20}$
but not suit exactly.
thanks in advance
推荐答案
^.+\\.+
您可能需要替换."与您的允许的字符"列表:
You may need to replace the "." with your "allowed character" list:
[a-zA-Z0-9_.-]
在"\\"的两侧
我建议您获得一份 Expresso [ ^ ]-它是免费的,可以评估,测试并生成正则表达式.希望我能写!
On both sides of the "\\"
I''d suggest you get a copy of Expresso[^] - it''s free, and it evaluates, tests, and generates Regexes. I wish I''d written it!
这篇关于我正在寻找匹配的正则表达式:sometext \ sometext的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!