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

    Join Date
    Dec 2013
    Posts
    5
    Rep Power
    0

    RegEx doesn't find special letters


    Hello Community

    I have a problem with special Letters like hex(c2)
    My regex doesn't find that this is not allowed:
    ^[\w\s\.\+\'\\/()@:;!&,_-]{1,70}$

    greetings from Germany
    Rainer
  2. #2
  3. Lord of the Dance
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2003
    Posts
    3,707
    Rep Power
    1959
    At which system do you try to run it?

    What kind of data do you want to match it against?
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2013
    Posts
    5
    Rep Power
    0
    Windows System
    I use C#, but this is not importand because the regEx doesn't find this not allowed letter. I tried it also at derekslager.com/blog/posts/2007/09/a-better-dotnet-regular-expression-tester.ashx
    The datas are in XML-File and posted to our webservice.
    I tried to post the phrase, but it doesn't work. Hex(c2) is not allowed here
  6. #4
  7. Lord of the Dance
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2003
    Posts
    3,707
    Rep Power
    1959
    You are using \w, which does seems to accept the Hex(c2) letter .

    If you for example only want to allow A-Z and a-z, you could try to specify that instead of \w.
    Last edited by MrFujin; December 19th, 2013 at 09:34 AM.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2013
    Posts
    5
    Rep Power
    0
    I tried it, but sorry, it doesn't work because
    \w is the same as [A-Za-z0-9_]
    Perhaps this patern is invisible. I cant't see it in NP++ or Windows Editor. I only see it in the HexEditor from NP++
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2013
    Posts
    5
    Rep Power
    0
    This is the Hex Code from the whole String:
    41 6c 74 65 73 20 52 61 64 c2 a0 31
    Altes Rad*1
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2013
    Posts
    5
    Rep Power
    0
    I found the solution.
    \s means all kinds of spaces
    if I take \x20 for the hexCode Space the problem was gone

    thanks!!!

IMN logo majestic logo threadwatch logo seochat tools logo