Question: Can any one tell me the regular expression for textfield which should not allow following characters and can accept other special characters,alphabets,numbers and so on :

```
+ - && || ! ( ) { } [ ] ^ " ~ * ? : \ @ &

```

Answer: 
this will not allow string that contains any of the characters in any part of the string mentioned above.

```
^(?!.*[+\-&|!(){}[\]^"~*?:@&]+).*$

```

* [See Here](https://dl.dropboxusercontent.com/u/29622718/regex1.JPG)

Brief Explanation

* Assert position at the beginning of a line (at beginning of the string or after a line break character) `^`
* Assert that it is impossible to match the regex below starting at this position (**negative lookahead**) `(?!.*[+\-&|!(){}[\]^"~*?:@&]+)`
	+ Match any single character that is not a line break character `.*`
		- Between zero and unlimited times, as many times as possible, giving back as needed (greedy) `*`
	+ Match a single character present in the list below `[+\-&|!(){}[\]^"~*?:@&]+`
		- Between one and unlimited times, as many times as possible, giving back as needed (greedy) `+`
		- The character "+" `+`
		- A "-" character `\-`
		- One of the characters `&|!(){}[” «&|!(){}[`
		- A "]" character `\]`
		- One of the characters `^"~*?:@&” «^"~*?:@&`
* Match any single character that is not a line break character `.*`
	+ Between zero and unlimited times, as many times as possible, giving back as needed (greedy) `*`
* Assert position at the end of a line (at the end of the string or before a line break character) `$`
Its usually better to whitelist characters you allow, rather than to blacklist characters you don't allow. both from a security standpoint, and from an ease of implementation standpoint.

If you do go down the blacklist route, here is an example, but be warned, the syntax is not simple.

<http://groups.google.com/group/regex/browse_thread/thread/0795c1b958561a07>

If you want to whitelist all the accent characters, perhaps using unicode ranges would help? Check out this link.

<http://www.regular-expressions.info/unicode.html>