作者:qwwdzfy | 来源:互联网 | 2023-05-17 17:23
Iwanttorestrictusageofunescapedampersandsinaparticularinputfield.Imhavingtroubleget
I want to restrict usage of unescaped ampersands in a particular input field. I'm having trouble getting a RegEx to kill usage of "&" unless followed by "amp;"...or perhaps just restrict usage of "& " (note the space).
我希望限制在特定输入字段中使用未转义的&号。我很难得到一个正则表达式来杀死“&”的用法,除非后面跟着“amp”。或者仅仅限制“&”的使用(注意空格)。
I tried to adapt the answer in this thread, but to no avail. Thanks.
我试图在这条线索中改写答案,但没有成功。谢谢。
(FWIW, here's a RegEx I made to ensure that a filename field didn't contain restrited chars. and ended in .mp3. It works fine, but does it look efficient?)
(FWIW,这是我创建的一个RegEx,以确保文件名字段中不包含受限制的chars。并以mp3。它工作得很好,但看起来有效率吗?
^[^&,<,>,:,",/,\\,|,?,\*]+(\.mp3|\.MP3|\.Mp3|\.mP3)$
2 个解决方案