#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2010
    Posts
    2
    Rep Power
    0

    Post Regex patter to match custom characters such as alphabets, digits, brackets, etc.


    Hi! I am working on VB .net and can't find Regex pattern to match these characters without any limit. I do not know about Regex much and I am weak in mathematics.

    Regex pattern which matches all alphabets (upper case and lower case), digits, brackets, and all other keyboard characters including space, new lines, commas, quotes, without limit. It is puzzling me and so bugs are coming in my application. If anyone gives me such a regex pattern, it would be so nice of him! . I have to match a text/data string to validate that if it only contains all these characters.

    Thank you to the community

    Tush.
  2. #2
  3. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,185
    Rep Power
    9398
    You give me the list of every character to accept, I'll give you the regular expression.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2010
    Posts
    2
    Rep Power
    0

    Thumbs up


    Originally Posted by requinix
    You give me the list of every character to accept, I'll give you the regular expression.
    Hi! Thanks for trying to help me.

    Characters:

    a to z, A to Z, 0 to 9, !@#$%^&*()_+|-=\`~{}[]:;"'<>,.?/

    new line, tab, space, carriage return, and all other characters which make up a complete readable text. A pattern which validates a text with all these characters without characters number limit.

    Thanks.
  6. #4
  7. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,185
    Rep Power
    9398
    Code:
    ^[a-zA-Z0-9!@#$%^&*()_+|\-=\\`~{}\[\]:;"'<>,.?/\w]$
    All I did was add a ^[ at the beginning, a ]$ at the end, use - for the three ranges, and escape a few characters.

    (PS: \w represents whitespace.)
  8. #5
  9. kill 9, $$;
    Devshed Supreme Being (6500+ posts)

    Join Date
    Sep 2001
    Location
    Shanghai, An tSín
    Posts
    6,898
    Rep Power
    3887
    Originally Posted by aroratushar
    ... and all other characters which make up a complete readable text ...
    You'll also need to specify what those are. What do you mean by "readable"? Visible? Or from a particular alphabet that you or your users understand (so blocking Chinese characters, for example).

IMN logo majestic logo threadwatch logo seochat tools logo