Java Doc for Perl5Compiler.java in  » Library » jakarta-oro-2.0.8 » org » apache » oro » text » regex » Java Source Code / Java DocumentationJava Source Code and Java Documentation

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 » Library » jakarta oro 2.0.8 » org.apache.oro.text.regex 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.oro.text.regex.Perl5Compiler

Perl5Compiler
final public class Perl5Compiler implements PatternCompiler(Code)
The Perl5Compiler class is used to create compiled regular expressions conforming to the Perl5 regular expression syntax. It generates Perl5Pattern instances upon compilation to be used in conjunction with a Perl5Matcher instance. Please see the user's guide for more information about Perl5 regular expressions.

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). If you want to use a single instance of each in a concurrent program, you must appropriately protect access to the instances with critical sections. If you want to share Perl5Pattern instances between concurrently executing instances of Perl5Matcher, you must compile the patterns with Perl5Compiler.READ_ONLY_MASK .
version:
   @version@
since:
   1.0
See Also:   PatternCompiler
See Also:   MalformedPatternException
See Also:   Perl5Pattern
See Also:   Perl5Matcher



Field Summary
final public static  intCASE_INSENSITIVE_MASK
     A mask passed as an option to the Perl5Compiler.compile compile methods to indicate a compiled regular expression should be case insensitive.
final public static  intDEFAULT_MASK
     The default mask for the Perl5Compiler.compile compile methods. It is equal to 0. The default behavior is for a regular expression to be case sensitive and to not specify if it is multiline or singleline.
final public static  intEXTENDED_MASK
     A mask passed as an option to the Perl5Compiler.compile compile methods to indicate a compiled regular expression should be treated as a Perl5 extended pattern (i.e., a pattern using the /x modifier).
final public static  intMULTILINE_MASK
     A mask passed as an option to the Perl5Compiler.compile compile methods to indicate a compiled regular expression should treat input as having multiple lines.
final public static  intREAD_ONLY_MASK
     A mask passed as an option to the Perl5Compiler.compile compile methods to indicate that the resulting Perl5Pattern should be treated as a read only data structure by Perl5Matcher, making it safe to share a single Perl5Pattern instance among multiple threads without needing synchronization.
final public static  intSINGLELINE_MASK
     A mask passed as an option to the Perl5Compiler.compile compile methods to indicate a compiled regular expression should treat input as being a single line.


Method Summary
public  Patterncompile(char[] pattern, int options)
     Compiles a Perl5 regular expression into a Perl5Pattern instance that can be used by a Perl5Matcher object to perform pattern matching. Please see the user's guide for more information about Perl5 regular expressions.


Parameters:
  pattern - A Perl5 regular expression to compile.
Parameters:
  options - A set of flags giving the compiler instructions onhow to treat the regular expression.

public  Patterncompile(char[] pattern)
     Same as calling compile(pattern, Perl5Compiler.DEFAULT_MASK);


Parameters:
  pattern - A regular expression to compile.

public  Patterncompile(String pattern)
     Same as calling compile(pattern, Perl5Compiler.DEFAULT_MASK);


Parameters:
  pattern - A regular expression to compile.

public  Patterncompile(String pattern, int options)
     Compiles a Perl5 regular expression into a Perl5Pattern instance that can be used by a Perl5Matcher object to perform pattern matching. Please see the user's guide for more information about Perl5 regular expressions.


Parameters:
  pattern - A Perl5 regular expression to compile.
Parameters:
  options - A set of flags giving the compiler instructions onhow to treat the regular expression.

final public static  Stringquotemeta(char[] expression)
     Given a character string, returns a Perl5 expression that interprets each character of the original string literally.
final public static  Stringquotemeta(String expression)
     Given a character string, returns a Perl5 expression that interprets each character of the original string literally.

Field Detail
CASE_INSENSITIVE_MASK
final public static int CASE_INSENSITIVE_MASK(Code)
A mask passed as an option to the Perl5Compiler.compile compile methods to indicate a compiled regular expression should be case insensitive.



DEFAULT_MASK
final public static int DEFAULT_MASK(Code)
The default mask for the Perl5Compiler.compile compile methods. It is equal to 0. The default behavior is for a regular expression to be case sensitive and to not specify if it is multiline or singleline. When MULITLINE_MASK and SINGLINE_MASK are not defined, the ^, $, and . metacharacters are interpreted according to the value of isMultiline() in Perl5Matcher. The default behavior of Perl5Matcher is to treat the Perl5Pattern as though MULTILINE_MASK were enabled. If isMultiline() returns false, then the pattern is treated as though SINGLINE_MASK were set. However, compiling a pattern with the MULTILINE_MASK or SINGLELINE_MASK masks will ALWAYS override whatever behavior is specified by the setMultiline() in Perl5Matcher.



EXTENDED_MASK
final public static int EXTENDED_MASK(Code)
A mask passed as an option to the Perl5Compiler.compile compile methods to indicate a compiled regular expression should be treated as a Perl5 extended pattern (i.e., a pattern using the /x modifier). This option tells the compiler to ignore whitespace that is not backslashed or within a character class. It also tells the compiler to treat the # character as a metacharacter introducing a comment as in Perl. In other words, the # character will comment out any text in the regular expression between it and the next newline. The intent of this option is to allow you to divide your patterns into more readable parts. It is provided to maintain compatibility with Perl5 regular expressions, although it will not often make sense to use it in Java.



MULTILINE_MASK
final public static int MULTILINE_MASK(Code)
A mask passed as an option to the Perl5Compiler.compile compile methods to indicate a compiled regular expression should treat input as having multiple lines. This option affects the interpretation of the ^ and $ metacharacters. When this mask is used, the ^ metacharacter matches at the beginning of every line, and the $ metacharacter matches at the end of every line. Additionally the . metacharacter will not match newlines when an expression is compiled with MULTILINE_MASK , which is its default behavior.



READ_ONLY_MASK
final public static int READ_ONLY_MASK(Code)
A mask passed as an option to the Perl5Compiler.compile compile methods to indicate that the resulting Perl5Pattern should be treated as a read only data structure by Perl5Matcher, making it safe to share a single Perl5Pattern instance among multiple threads without needing synchronization. Without this option, Perl5Matcher reserves the right to store heuristic or other information in Perl5Pattern that might accelerate future matches. When you use this option, Perl5Matcher will not store or modify any information in a Perl5Pattern. Use this option when you want to share a Perl5Pattern instance among multiple threads using different Perl5Matcher instances.



SINGLELINE_MASK
final public static int SINGLELINE_MASK(Code)
A mask passed as an option to the Perl5Compiler.compile compile methods to indicate a compiled regular expression should treat input as being a single line. This option affects the interpretation of the ^ and $ metacharacters. When this mask is used, the ^ metacharacter matches at the beginning of the input, and the $ metacharacter matches at the end of the input. The ^ and $ metacharacters will not match at the beginning and end of lines occurring between the begnning and end of the input. Additionally, the . metacharacter will match newlines when an expression is compiled with SINGLELINE_MASK , unlike its default behavior.





Method Detail
compile
public Pattern compile(char[] pattern, int options) throws MalformedPatternException(Code)
Compiles a Perl5 regular expression into a Perl5Pattern instance that can be used by a Perl5Matcher object to perform pattern matching. Please see the user's guide for more information about Perl5 regular expressions.


Parameters:
  pattern - A Perl5 regular expression to compile.
Parameters:
  options - A set of flags giving the compiler instructions onhow to treat the regular expression. The flagsare a logical OR of any number of the five MASKconstants. For example:

regex =compiler.compile(pattern, Perl5Compiler.CASE_INSENSITIVE_MASK |Perl5Compiler.MULTILINE_MASK);
This says to compile the pattern so that it treatsinput as consisting of multiple lines and to performmatches in a case insensitive manner. A Pattern instance constituting the compiled regular expression.This instance will always be a Perl5Pattern and can be reliablycasted to a Perl5Pattern.
exception:
  MalformedPatternException - If the compiled expressionis not a valid Perl5 regular expression.



compile
public Pattern compile(char[] pattern) throws MalformedPatternException(Code)
Same as calling compile(pattern, Perl5Compiler.DEFAULT_MASK);


Parameters:
  pattern - A regular expression to compile. A Pattern instance constituting the compiled regular expression.This instance will always be a Perl5Pattern and can be reliablycasted to a Perl5Pattern.
exception:
  MalformedPatternException - If the compiled expressionis not a valid Perl5 regular expression.




compile
public Pattern compile(String pattern) throws MalformedPatternException(Code)
Same as calling compile(pattern, Perl5Compiler.DEFAULT_MASK);


Parameters:
  pattern - A regular expression to compile. A Pattern instance constituting the compiled regular expression.This instance will always be a Perl5Pattern and can be reliablycasted to a Perl5Pattern.
exception:
  MalformedPatternException - If the compiled expressionis not a valid Perl5 regular expression.




compile
public Pattern compile(String pattern, int options) throws MalformedPatternException(Code)
Compiles a Perl5 regular expression into a Perl5Pattern instance that can be used by a Perl5Matcher object to perform pattern matching. Please see the user's guide for more information about Perl5 regular expressions.


Parameters:
  pattern - A Perl5 regular expression to compile.
Parameters:
  options - A set of flags giving the compiler instructions onhow to treat the regular expression. The flagsare a logical OR of any number of the five MASKconstants. For example:

regex =compiler.compile("^\\w+\\d+$",Perl5Compiler.CASE_INSENSITIVE_MASK |Perl5Compiler.MULTILINE_MASK);
This says to compile the pattern so that it treatsinput as consisting of multiple lines and to performmatches in a case insensitive manner. A Pattern instance constituting the compiled regular expression.This instance will always be a Perl5Pattern and can be reliablycasted to a Perl5Pattern.
exception:
  MalformedPatternException - If the compiled expressionis not a valid Perl5 regular expression.



quotemeta
final public static String quotemeta(char[] expression)(Code)
Given a character string, returns a Perl5 expression that interprets each character of the original string literally. In other words, all special metacharacters are quoted/escaped. This method is useful for converting user input meant for literal interpretation into a safe regular expression representing the literal input.

In effect, this method is the analog of the Perl5 quotemeta() builtin method.


Parameters:
  expression - The expression to convert. A String containing a Perl5 regular expression corresponding toa literal interpretation of the pattern.




quotemeta
final public static String quotemeta(String expression)(Code)
Given a character string, returns a Perl5 expression that interprets each character of the original string literally. In other words, all special metacharacters are quoted/escaped. This method is useful for converting user input meant for literal interpretation into a safe regular expression representing the literal input.

In effect, this method is the analog of the Perl5 quotemeta() builtin method.


Parameters:
  pattern - The pattern to convert. A String containing a Perl5 regular expression corresponding toa literal interpretation of the pattern.




Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.