regular expression

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vinitas
    New Member
    • Mar 2007
    • 1

    #1

    regular expression

    Hi,

    i want to know how to disallow & ,<> in regular expression
    I am tryng to use regular expression in an xml file to disallow all special characters ,but it throws an error when i include <> , &
    kindly suggest
  • sicarie
    Recognized Expert Specialist
    • Nov 2006
    • 4677

    #2
    Originally posted by vinitas
    Hi,

    i want to know how to disallow & ,<> in regular expression
    I am tryng to use regular expression in an xml file to disallow all special characters ,but it throws an error when i include <> , &
    kindly suggest
    Here's a link to Java's tutorial on regex's. And here is the Javadoc on Patterns - which gives the characters.

    I pass those along because it might be difficult to troubleshoot without the regex you're using (if this doesn't work, please post it along with the error you are getting), but I would recommend checking out the Pattern class - especially with POSIX character classes. I haven't used it myself, but it looks like the greater-than/less-than characters need to be preceded by a \p, and possibly be in brackets. I'm sure if you mess around with that stuff, you can get it, and then I believe the ampersand & should be backwhacked, so the compiler doesn't read it as a metacharacter.

    Comment

    • r035198x
      MVP
      • Sep 2006
      • 13225

      #3
      Originally posted by vinitas
      Hi,

      i want to know how to disallow & ,<> in regular expression
      I am tryng to use regular expression in an xml file to disallow all special characters ,but it throws an error when i include <> , &
      kindly suggest
      What error did you get?

      Comment

      Working...