^ = logical not
\w = shortcut for alphanumeric. i.e. a-z, A-Z, 0-9, _
- = dash
. = full stop
space bar pressed here = space bar
[\\w-. ] = regular expression for valid characters.
[^\\w-. ] = regular expression for not valid characters (i.e.invalid characters).
//find a character that is not valid (ie. invalid characters are a-z, A-Z, 0-9, _, dash, full stop, and space bar
String regex = "[^\\w-. ]";
---------------------------------------------------------
Below are the common symbols you will often find:
^ The beginning of the line.
$ The end of the line.
. Any single character.
* Zero or more repetitions of the previous expression.
+ One or more repetitions of the previous expression.
[] Any of the characters inside the brackets will match—e.g., [abc] matches any of a, b, c. Ranges are allowed too—e.g., [a-z].
Thursday, October 25, 2007
Subscribe to:
Post Comments (Atom)
About Me
Labels
- eclipse (2)
- java (13)
- javascript (2)
- linux (8)
- regex (1)
- spring (2)
- sql (1)
- Web Service (1)
- Websphere Application Server (1)
- Websphere Integration Developer (1)
- Websphere Process Server (1)
Blog Archive
-
►
2008
(17)
-
►
March
(8)
- java: An algorithm for converting an array to comm...
- java: How to convert String array to Long array
- java: How to put checkboxes in DisplayTag using St...
- javascript: How to select/deselect checkboxes
- java: How to get DisplayTag sorting URL to work in...
- java: How to convert a String ArrayList into Strin...
- java: The difference between the HTML comment <!...
- java: Why Log4J's Logger should be declared static...
-
►
March
(8)
1 comments:
Also
^ The beginning of the line.
$ The end of the line.
. Any single character.
* Zero or more repetitions of the previous expression.
+ One or more repetitions of the previous expression.
[] Any of the characters inside the brackets will match—e.g., [abc] matches any of a, b, c. Ranges are allowed too—e.g., [a-z].
Post a Comment