org.apache.oro.text.regex

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Development » Jakarta ORO » org.apache.oro.text.regex 
org.apache.oro.text.regex
This package used to be the OROMatcher library and provides both generic regular expression interfaces and Perl5 regular expression compatible implementation classes.

Note: The following information will be moved into the user's guide.

Perl5 regular expressions

Here we summarize the syntax of Perl5.003 regular expressions, all of which is supported by the Perl5 classes in this package. However, for a definitive reference, you should consult the perlre man page that accompanies the Perl5 distribution and also the book Programming Perl, 2nd Edition from O'Reilly & Associates. We are working toward implementing the features added after Perl5.003 up to and including Perl 5.6. Please remember, we only guarantee support for Perl5.003 expressions in version 2.0.

  • Alternatives separated by |
  • Quantified atoms
    {n,m}
    Match at least n but not more than m times.
    {n,}
    Match at least n times.
    {n}
    Match exactly n times.
    *
    Match 0 or more times.
    +
    Match 1 or more times.
    ?
    Match 0 or 1 times.
  • Atoms
    • regular expression within parentheses
    • a . matches everything except \n
    • a ^ is a null token matching the beginning of a string or line (i.e., the position right after a newline or right before the beginning of a string)
    • a $ is a null token matching the end of a string or line (i.e., the position right before a newline or right after the end of a string)
    • Character classes (e.g., [abcd]) and ranges (e.g. [a-z])
      • Special backslashed characters work within a character class (except for backreferences and boundaries).
      • \b is backspace inside a character class
    • Special backslashed characters
      \b
      null token matching a word boundary (\w on one side and \W on the other)
      \B
      null token matching a boundary that isn't a word boundary
      \A
      Match only at beginning of string
      \Z
      Match only at end of string (or before newline at the end)
      \n
      newline
      \r
      carriage return
      \t
      tab
      \f
      formfeed
      \d
      digit [0-9]
      \D
      non-digit [^0-9]
      \w
      word character [0-9a-z_A-Z]
      \W
      a non-word character [^0-9a-z_A-Z]
      \s
      a whitespace character [ \t\n\r\f]
      \S
      a non-whitespace character [^ \t\n\r\f]
      \xnn
      hexadecimal representation of character
      \cD
      matches the corresponding control character
      \nn or \nnn
      octal representation of character unless a backreference. a
      \1, \2, \3, etc.
      match whatever the first, second, third, etc. parenthesized group matched. This is called a backreference. If there is no corresponding group, the number is interpreted as an octal representation of a character.
      \0
      matches null character
      Any other backslashed character matches itself
  • Expressions within parentheses are matched as subpattern groups and saved for use by certain methods.

By default, a quantified subpattern is greedy . In other words it matches as many times as possible without causing the rest of the pattern not to match. To change the quantifiers to match the minimum number of times possible, without causing the rest of the pattern not to match, you may use a "?" right after the quantifier.

*?
Match 0 or more times
+?
Match 1 or more times
??
Match 0 or 1 time
{n}?
Match exactly n times
{n,}?
Match at least n times
{n,m}?
Match at least n but not more than m times

Perl5 extended regular expressions are fully supported.

(?#text)
An embedded comment causing text to be ignored.
(?:regexp)
Groups things like "()" but doesn't cause the group match to be saved.
(?=regexp)
A zero-width positive lookahead assertion. For example, \w+(?=\s) matches a word followed by whitespace, without including whitespace in the MatchResult.
(?!regexp)
A zero-width negative lookahead assertion. For example foo(?!bar) matches any occurrence of "foo" that isn't followed by "bar". Remember that this is a zero-width assertion, which means that a(?!b)d will match ad because a is followed by a character that is not b (the d) and a d follows the zero-width assertion.
(?imsx)
One or more embedded pattern-match modifiers. i enables case insensitivity, m enables multiline treatment of the input, s enables single line treatment of the input, and x enables extended whitespace comments.
Java Source File NameTypeComment
CharStringPointer.javaClass The CharStringPointer class is used to facilitate traversal of a char[] in the manner pointer traversals of strings are performed in C/C++.
MalformedPatternException.javaClass A class used to signify the occurrence of a syntax error in a regular expression that is being compiled.
MatchResult.javaInterface The MatchResult interface allows PatternMatcher implementors to return results storing match information in whatever format they like, while presenting a consistent way of accessing that information.
OpCode.javaClass The OpCode class should not be instantiated.
Pattern.javaInterface The Pattern interface allows multiple representations of a regular expression to be defined.
PatternCompiler.javaInterface The PatternCompiler interface defines the operations a regular expression compiler must implement.
PatternMatcher.javaInterface The PatternMatcher interface defines the operations a regular expression matcher must implement.
PatternMatcherInput.javaClass The PatternMatcherInput class is used to preserve state across calls to the contains() methods of PatternMatcher instances. It is also used to specify that only a subregion of a string should be used as input when looking for a pattern match.
Perl5Compiler.javaClass The Perl5Compiler class is used to create compiled regular expressions conforming to the Perl5 regular expression syntax.
Perl5Debug.javaClass The Perl5Debug class is not intended for general use and should not be instantiated, but is provided because some users may find the output of its single method to be useful. The Perl5Compiler class generates a representation of a regular expression identical to that of Perl5 in the abstract, but not in terms of actual data structures.
Perl5Matcher.javaClass The Perl5Matcher class is used to match regular expressions (conforming to the Perl5 regular expression syntax) generated by Perl5Compiler.

Perl5Compiler and Perl5Matcher are designed with the intent that you use a separate instance of each per thread to avoid the overhead of both synchronization and concurrent access (e.g., a match that takes a long time in one thread will block the progress of another thread with a shorter match).

Perl5MatchResult.javaClass A class used to store and access the results of a Perl5Pattern match.
Perl5Pattern.javaClass An implementation of the Pattern interface for Perl5 regular expressions. This class is compatible with the Perl5Compiler and Perl5Matcher classes.
Perl5Repetition.javaClass Perl5Repetition is a support class for Perl5Matcher.
Perl5Substitution.javaClass Perl5Substitution implements a Substitution consisting of a literal string, but allowing Perl5 variable interpolation referencing saved groups in a match.
StringSubstitution.javaClass StringSubstitution implements a Substitution consisting of a simple literal string.
Substitution.javaInterface The Substitution interface provides a means for you to control how a substitution is performed when using the Util.substitute Util.substitute method.
Util.javaClass The Util class is a holder for useful static utility methods that can be generically applied to Pattern and PatternMatcher instances. This class cannot and is not meant to be instantiated. The Util class currently contains versions of the split() and substitute() methods inspired by Perl's split function and s operation respectively, although they are implemented in such a way as not to rely on the Perl5 implementations of the OROMatcher packages regular expression interfaces.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.