Concepts
- Literal Match: "dog", "cat"
- Character classes: [Tt], [a-z]
- Repetitions matches: [Tt]*, [Tt]{2,3}
- Look behind/look ahead assertion: (?<=)abc
- Combinations of above
Character classes
[abc]
- will match one character
- it will match any one of the character a or b or c
Character class | Posix | Grep | Java | Meaning |
---|---|---|---|---|
[a-z] | A single lower case english aplhabets | |||
[A-Z] | An single upper case english aplhabets | |||
[0-9] | A single digit | |||
[a-zA-Z] | [:alpha:] | \a | \p{Alpha} | A single enligh alphabet either upper case or lower case |
[a-zA-Z0-9] | [:alnum:] | \p{Alnum} | A single enligh alphabet either upper case or lower case |