regular expression which should allow limited special characters

user1268130

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 :

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

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

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

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) $

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Regular Expression to allow specific special characters

From Dev

Regular expression to allow either number or special characters

From Dev

Regular Expression for special characters

From Dev

Regular expression to allow alphabets and onle one occurrence of select special characters

From Dev

Regular expression to avoid special characters and should not start with numbers

From Dev

Regular expression of validating text which contains certain special characters on condition

From Dev

Reg Expression to ignore limited special characters javascript

From Dev

Special Characters in JFlex Regular Expression

From Dev

Writing a regular expression with special characters

From Dev

Python Regular Expression with special characters

From Dev

Matching special characters with Regular Expression

From Dev

PHP Regular Expression special characters

From Dev

Special Characters in JFlex Regular Expression

From Dev

Regular expression for special characters and numericals

From Dev

Regular expression with drools (special characters /* )

From Dev

regular expression for match 1 alphabet, 1 digit and allow all special characters

From Dev

Regular expression to allow only one special character?

From Dev

Regular Expression accepting only 9 digits, no special characters , not all zero's and should not start with zero

From Dev

javascript- regular expression alphanumeric and special characters

From Dev

Regular Expression for Validation of files and Special characters

From Dev

c# Regular Expression : Special characters: ~!@©#$%^&*()_+{}|:"<>?`€[]\;',./

From Dev

Regular Expression for excluding numbers or special characters

From Dev

Perl Regular Expression to match special characters

From Dev

javascript regular expression to recognize all special characters

From Dev

Regular expression to support strings contacting special characters

From Dev

Regular Expression - can't checking for special characters [ ]

From Dev

Regular Expression for not allowing two consecutive special characters

From Dev

Regular Expression starting and ending with special characters

From Dev

remove special characters with regular expression in PHP

Related Related

  1. 1

    Regular Expression to allow specific special characters

  2. 2

    Regular expression to allow either number or special characters

  3. 3

    Regular Expression for special characters

  4. 4

    Regular expression to allow alphabets and onle one occurrence of select special characters

  5. 5

    Regular expression to avoid special characters and should not start with numbers

  6. 6

    Regular expression of validating text which contains certain special characters on condition

  7. 7

    Reg Expression to ignore limited special characters javascript

  8. 8

    Special Characters in JFlex Regular Expression

  9. 9

    Writing a regular expression with special characters

  10. 10

    Python Regular Expression with special characters

  11. 11

    Matching special characters with Regular Expression

  12. 12

    PHP Regular Expression special characters

  13. 13

    Special Characters in JFlex Regular Expression

  14. 14

    Regular expression for special characters and numericals

  15. 15

    Regular expression with drools (special characters /* )

  16. 16

    regular expression for match 1 alphabet, 1 digit and allow all special characters

  17. 17

    Regular expression to allow only one special character?

  18. 18

    Regular Expression accepting only 9 digits, no special characters , not all zero's and should not start with zero

  19. 19

    javascript- regular expression alphanumeric and special characters

  20. 20

    Regular Expression for Validation of files and Special characters

  21. 21

    c# Regular Expression : Special characters: ~!@©#$%^&*()_+{}|:"<>?`€[]\;',./

  22. 22

    Regular Expression for excluding numbers or special characters

  23. 23

    Perl Regular Expression to match special characters

  24. 24

    javascript regular expression to recognize all special characters

  25. 25

    Regular expression to support strings contacting special characters

  26. 26

    Regular Expression - can't checking for special characters [ ]

  27. 27

    Regular Expression for not allowing two consecutive special characters

  28. 28

    Regular Expression starting and ending with special characters

  29. 29

    remove special characters with regular expression in PHP

HotTag

Archive