我使用简单的正则表达式测试字符串,它可以正常工作,直到我添加分隔符。有人可以解释为什么会发生这种情况,我是否必须在每个正则表达式中添加分隔符?
:*:``abc1::
; Read the contents of the backup file
FileRead, Contents, C:\Windows\System32\drivers\etc\hosts-backup.txt
if not ErrorLevel ; Successfully loaded.
{
ListVars
Pause
; delete the old hots file
FileDelete, C:\Windows\System32\drivers\etc\hosts.txt
; also tried this with C:\Windows\System32\drivers\etc\hosts
; save a new copy of the hosts file with the content from the backup file
FileAppend, %Contents%, C:\Windows\System32\drivers\etc\hosts.txt
; also tried this with C:\Windows\System32\drivers\etc\hosts
Contents = ; Free the memory.
}
return
答案 0 :(得分:4)
使用分隔符时,您在JavaScript中引用 引用regexp。
var cCheckB = /^[0-9a-zA-Z\-\u0590-\u05FF !?.,]+$/;
答案 1 :(得分:1)
我怀疑你正在尝试使用正则表达式文字,在javascript中用'/'分隔。但是,如果您使用它,则不需要它周围的引号。
cCheck = /^[0-9a-zA-Z\-\u0590-\u05FF !?.,]+$/