简体   繁体   English

错误:[处理此指令时发生错误]和正则表达式混淆

[英]Error : [an error occurred while processing this directive] and regular expression confusion

I have downloaded a website using ftp , when I test the site in my host , it shows the error 我已经使用ftp下载了一个网站,当我在主机中测试该网站时,显示错误

[an error occurred while processing this directive]

You can check this error here http://www.excoflare.com/dev2011/amplitechnic/ 您可以在这里检查此错误http://www.excoflare.com/dev2011/amplitechnic/

Also, I am struggle to get a regular expression for a valid floating point number . 另外,我很难获得有效浮点数的正则表达式。 I used this one : 我用了这个:

expression: "if (VAL.match(/^[0-9]*\\.?[0-9]/)) return true; else return false;",

But the above expression returns true even if I write say 1.x ? 但是,即使我写了1.x ,上面的表达式也返回true。

Sorry I put the questions together. 对不起,我把问题放在一起了。

It's a web server error: 这是一个网络服务器错误:

Usually, when something goes wrong with your SSI directive, you get the message [an error occurred while processing this directive] 通常,当您的SSI指令出问题时,您会收到消息[处理此指令时发生错误]

Apache Tutorial: Introduction to Server Side Includes Apache教程:服务器端包含的简介

It is probably caused by something that looks like an SSI directive in you page's code: 它可能是由您页面代码中的SSI指令引起的:

<!-- Here's the call to the silent-counter script -->
[an error occurred while processing this directive]
<!-------------------------------------------------->

SSI directives have the following syntax: SSI指令具有以下语法:

<!--#element attribute=value attribute=value ... -->

Also, why use regexps when there are specialized functions for determining whether it is a float or not, like is_numeric or is_float (if you need to check variable type) in php. 另外,为什么在有专门的函数来确定它是否为浮点数时使用正则表达式,例如php中的is_numeric或is_float(如果需要检查变量类型)。

For jQuery client-side validation you could use JavaScripts parseFloat() function (if it returns NaN, when your input is not a number). 对于jQuery客户端验证,您可以使用JavaScript的parseFloat()函数(如果您输入的不是数字,则返回NaN)。 as suggested here: jQuery input validation for double/float 如此处建议: jQuery输入验证为double / float

If you want a regexp, you may have a look at this question: Javascript/jQuery - Float Validating? 如果您想使用正则表达式,则可以查看以下问题: Javascript / jQuery-浮动验证?

^[0-9]*\.?[0-9]

Will match the 1 and since you have no end of line anchor $ it matches (partially) your input. 将与1匹配,并且由于您没有行尾锚$,因此它将(部分)与您的输入匹配。

For a better floating point regex you can use this : 为了获得更好的浮点正则表达式,可以使用以下命令:

^[-+]?[0-9]*\.?[0-9]+\b$

This disregards scientific notation. 这无视科学表示法。 It matches an integer or a floating point number with optional integer part. 它将整数或浮点数与可选的整数部分匹配。 The sign is optional. 该标志是可选的。

If you also want to match scientific notation you can use this : 如果您还想匹配科学计数法,则可以使用以下方法:

^[-+]?(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)(?:[eE][-+]?[0-9]+)?$

About the other error I can't help. 关于其他错误,我无能为力。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM