Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java regex

/*
The Java Regex or Regular Expression is an API to define a pattern for searching 
or manipulating strings.
*/

// Regex Character classes
1. [abc] ----- a, b, or c (simple class)
2. [^abc]   -- Any character except a, b, or c (negation)
3. [a-zA-Z] -- a through z or A through Z, inclusive (range)  
4. [a-d[m-p]] --  a through d, or m through p: [a-dm-p] (union) 
5. [a-z&&[def]] -- d, e, or f (intersection)
6. [a-z&&[^bc]]  -- a through z, except for b and c: [ad-z] (subtraction)
7. [a-z&&[^m-p]] -- a through z, and not m through p: [a-lq-z](subtraction)

Please click source link for more details


Source by www.javatpoint.com #
 
PREVIOUS NEXT
Tagged: #java #regex
ADD COMMENT
Topic
Name
1+8 =