Escapes the / character for FireFox 1.0.

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@151024 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Kelvin Tan 2005-01-04 15:38:49 +00:00
parent 67bcfc69b8
commit 96c0bf9c90
1 changed files with 8 additions and 8 deletions

View File

@ -103,7 +103,7 @@ function removeEscapes(query)
function checkAllowedCharacters(query)
{
matches = query.match(/[^a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#/$%'= ]/);
matches = query.match(/[^a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#\/$%'= ]/);
if(matches != null && matches.length > 0)
{
if(alertUser) alert("Invalid search query! The allowed characters are a-z A-Z 0-9. _ + - : () \" & * ? | ! {} [ ] ^ ~ \\ @ = # % $ ' /. Please try again.")
@ -129,7 +129,7 @@ function checkAmpersands(query)
matches = query.match(/[&]{2}/);
if(matches != null && matches.length > 0)
{
matches = query.match(/^([a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#/$%'=]+( && )?[a-zA-Z0-9_+\-:.()\"*?|!{}\[\]\^~\\@#/$%'=]+[ ]*)+$/); // note missing & in pattern
matches = query.match(/^([a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#\/$%'=]+( && )?[a-zA-Z0-9_+\-:.()\"*?|!{}\[\]\^~\\@#\/$%'=]+[ ]*)+$/); // note missing & in pattern
if(matches == null)
{
if(alertUser) alert("Invalid search query! Queries containing the special characters && must be in the form: term1 && term2. Please try again.")
@ -141,7 +141,7 @@ function checkAmpersands(query)
function checkCaret(query)
{
//matches = query.match(/^[^\^]*$|^([a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\~\\@#/]+(\^[\d]+)?[ ]*)+$/); // note missing ^ in pattern
//matches = query.match(/^[^\^]*$|^([a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\~\\@#\/]+(\^[\d]+)?[ ]*)+$/); // note missing ^ in pattern
matches = query.match(/[^\\]\^([^\s]*[^0-9.]+)|[^\\]\^$/);
if(matches != null)
{
@ -153,7 +153,7 @@ function checkCaret(query)
function checkSquiggle(query)
{
//matches = query.match(/^[^~]*$|^([a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^\\@#/]+(~[\d.]+|[^\\]\\~)?[ ]*)+$/); // note missing ~ in pattern
//matches = query.match(/^[^~]*$|^([a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^\\@#\/]+(~[\d.]+|[^\\]\\~)?[ ]*)+$/); // note missing ~ in pattern
matches = query.match(/[^\\]~[^\s]*[^0-9\s]+/);
if(matches != null)
{
@ -167,7 +167,7 @@ function checkExclamationMark(query)
{
// foo! is not a query, but !foo is. hmmmm...
// NB: doesn't handle term1 ! term2 ! term3 or term1 !term2
matches = query.match(/^[^!]*$|^([a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#/$%'=]+( ! )?[a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#/$%'=]+[ ]*)+$/);
matches = query.match(/^[^!]*$|^([a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#\/$%'=]+( ! )?[a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#\/$%'=]+[ ]*)+$/);
if(matches == null || matches.length == 0)
{
if(alertUser) alert("Invalid search query! Queries containing the special character ! must be in the form: term1 ! term2. Please try again.")
@ -180,7 +180,7 @@ function checkExclamationMark(query)
function checkQuestionMark(query)
{
matches = query.match(/^(\?)|([^a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#/$%'=]\?+)/);
matches = query.match(/^(\?)|([^a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#\/$%'=]\?+)/);
if(matches != null && matches.length > 0)
{
if(alertUser) alert("Invalid search query! The question mark (?) character must be preceded by at least one alphabet or number. Please try again.")
@ -226,7 +226,7 @@ function checkParentheses(query)
function checkPlusMinus(query)
{
matches = query.match(/^[^\n+\-]*$|^([+-]?[a-zA-Z0-9_:.()\"*?&|!{}\[\]\^~\\@#/$%'=]+[ ]?)+$/);
matches = query.match(/^[^\n+\-]*$|^([+-]?[a-zA-Z0-9_:.()\"*?&|!{}\[\]\^~\\@#\/$%'=]+[ ]?)+$/);
if(matches == null || matches.length == 0)
{
if(alertUser) alert("Invalid search query! '+' and '-' modifiers must be followed by at least one alphabet or number. Please try again.")
@ -240,7 +240,7 @@ function checkANDORNOT(query)
matches = query.match(/AND|OR|NOT/);
if(matches != null && matches.length > 0)
{
matches = query.match(/^([a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^~\\@/#$%'=]+\s*((AND )|(OR )|(AND NOT )|(NOT ))?[a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^~\\@/#$%'=]+[ ]*)+$/);
matches = query.match(/^([a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^~\\@\/#$%'=]+\s*((AND )|(OR )|(AND NOT )|(NOT ))?[a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^~\\@\/#$%'=]+[ ]*)+$/);
if(matches == null || matches.length == 0)
{
if(alertUser) alert("Invalid search query! Queries containing AND/OR/NOT must be in the form: term1 AND|OR|NOT|AND NOT term2 Please try again.")