如何检查没有空格的输入字符串&特殊字符,但两个特殊字符(即&和Ñ)除外 [英] How to check input string with no spaces & special characters except two special charaters (that is & and Ñ)

查看:86
本文介绍了如何检查没有空格的输入字符串&特殊字符,但两个特殊字符(即&和Ñ)除外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试验证input string(可以将其复制并粘贴到文本框中). 输入的输入应包含一个或多个alphabetic characters,数字和另外两个特殊字符,例如(&Ñ),但不能包含空格.

I am trying to validate an input string (which can be copied & pasted in the textbox). The input entered should contain one or more alphabetic characters, numbers and two more special characters as (& and Ñ), but no embedded spaces.

NB:必须显示字母字符,但数字&这两个特殊字符可能会也可能不会出现,以创建有效的输入.

NB: Alphabetic characters must present, but numbers & those two special characters may or may not present to create a valid input.

我正在使用Jquery进行客户端验证.

I am using Jquery for client side validation.

  • 替代方法:

如果有人可以帮助我,我们如何检测是否出现了特殊字符和空格(&"除外)和任何输入字符串中的Ñ",那么我的问题也可以解决.

If anyone can help me how we can detect the occurrence of any special characters and spaces, except '&' and 'Ñ' in any input string, then also my problem can be resolved.

推荐答案

实际上,我已经完成了Jquery alphanumeric插件

Actually I am done with the validation with Jquery alphanumeric plugin

"$('#txtId').alphanumeric({ allow: "&Ñ" });".

说明:这允许所有alpha numeric字符&限制所有其他字符(已解决特殊字符).在允许部分中,我可以放置允许的特殊字符.

Explanation: This allows all alpha numeric characters & restricts all other characters (special characters got addressed). In the allow part I could place the allowable special characters.

这篇关于如何检查没有空格的输入字符串&特殊字符,但两个特殊字符(即&和Ñ)除外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆