Package org.pcre4j
Class Pcre2Code
java.lang.Object
org.pcre4j.Pcre2Code
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionPcre2Code(String pattern, EnumSet<Pcre2CompileOption> options, Pcre2CompileContext compileContext) Constructor for Pcre2Code -
Method Summary
Modifier and TypeMethodDescriptionorg.pcre4j.api.IPcre2api()Get the PCRE2 API backing this compiled patternGet the compile optionsintGet the number of highest backreferencebsr()Get what \R matches:Pcre2Bsr.UNICODEfor Unicode line endingsPcre2Bsr.ANYCRLFfor CR, LF, or CRLF onlyintGet the number of capturing subpatternsintGet the backtracking depth limitlongGet the size of backtracking framelonghandle()Get the handle of the compiled patternbooleanCheck if the pattern contains \CbooleanCheck if explicit CR or LF matches exist in the patternintGet the heap limitbooleanjChanged()Check if the pattern uses (?J) or (?-J)longjitSize()Get the size of JIT compiled code, or 0intmatch(String subject, int startoffset, EnumSet<Pcre2MatchOption> options, Pcre2MatchData matchData, Pcre2MatchContext matchContext) Match this compiled pattern against a given subject string.booleanCheck if the pattern can match an empty stringintGet the match limitintGet the length (in characters) of the longest lookbehind assertionintGet the lower bound length of matching stringsintGet the number of named subpatternsintGet the size of name table entriesGet the name tablenewline()Get the newline sequencelongsize()Get the size of the compiled pattern
-
Constructor Details
-
Pcre2Code
public Pcre2Code(String pattern, EnumSet<Pcre2CompileOption> options, Pcre2CompileContext compileContext) Constructor for Pcre2Code- Parameters:
pattern- the pattern to compileoptions- the flags to compile the pattern with, seePcre2CompileOptioncompileContext- the compile context to use or null
-
-
Method Details
-
api
public org.pcre4j.api.IPcre2 api()Get the PCRE2 API backing this compiled pattern- Returns:
- the PCRE2 API
-
handle
public long handle()Get the handle of the compiled pattern- Returns:
- the handle of the compiled pattern
-
backRefMax
public int backRefMax()Get the number of highest backreference- Returns:
- the number of highest backreference
-
argOptions
Get the compile options- Returns:
- the compile options
-
captureCount
public int captureCount()Get the number of capturing subpatterns- Returns:
- the number of capturing subpatterns
-
bsr
Get what \R matches:Pcre2Bsr.UNICODEfor Unicode line endingsPcre2Bsr.ANYCRLFfor CR, LF, or CRLF only- Returns:
- what \R matches
-
depthLimit
public int depthLimit()Get the backtracking depth limit- Returns:
- the backtracking depth limit
-
frameSize
public long frameSize()Get the size of backtracking frame- Returns:
- the size of backtracking frame
-
hasBackslashC
public boolean hasBackslashC()Check if the pattern contains \C- Returns:
- true if the pattern contains \C, false otherwise
-
hasCrOrLf
public boolean hasCrOrLf()Check if explicit CR or LF matches exist in the pattern- Returns:
- true if explicit CR or LF matches exist in the pattern, false otherwise
-
heapLimit
public int heapLimit()Get the heap limit- Returns:
- the heap limit
-
jChanged
public boolean jChanged()Check if the pattern uses (?J) or (?-J)- Returns:
- true if the pattern uses (?J) or (?-J), false otherwise
-
jitSize
public long jitSize()Get the size of JIT compiled code, or 0- Returns:
- the size of JIT compiled code, or 0
-
matchEmpty
public boolean matchEmpty()Check if the pattern can match an empty string- Returns:
- true if the pattern can match an empty string, false otherwise
-
matchLimit
public int matchLimit()Get the match limit- Returns:
- the match limit
-
maxLookBehind
public int maxLookBehind()Get the length (in characters) of the longest lookbehind assertion- Returns:
- the length (in characters) of the longest lookbehind assertion
-
minLength
public int minLength()Get the lower bound length of matching strings- Returns:
- the lower bound length of matching strings
-
nameCount
public int nameCount()Get the number of named subpatterns- Returns:
- the number of named subpatterns
-
newline
Get the newline sequence- Returns:
- the newline sequence
-
nameEntrySize
public int nameEntrySize()Get the size of name table entries- Returns:
- the size of name table entries
-
nameTable
Get the name table- Returns:
- the name table
-
size
public long size()Get the size of the compiled pattern- Returns:
- the size of the compiled pattern
-
match
public int match(String subject, int startoffset, EnumSet<Pcre2MatchOption> options, Pcre2MatchData matchData, Pcre2MatchContext matchContext) Match this compiled pattern against a given subject string.- Parameters:
subject- the subject string to match this pattern againststartoffset- offset in the subject at which to start matchingoptions- the options, seePcre2MatchOptionmatchData- the match data to store the results inmatchContext- the match context to use or null- Returns:
- the number of captures plus one, zero if the
matchDatais too small, or a negative value if there was no match or an actual error occurred
-