Package com.logicaldoc.core.automation
Class RegexTool
java.lang.Object
com.logicaldoc.core.automation.RegexTool
Various Regex-based APIs to make it easy to manipulate regular expressions
 from Automation.
- Since:
- 8.7.4
- 
Nested Class SummaryNested Classes
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionCompiles a regular expression into a javaPatternobject.Finds the matches into a given content using a given regular expressionFinds the matches into a given content using a given regular expressionReturns a literal patternStringfor the specifiedString.Returns a literal replacementStringfor the specifiedString.
- 
Constructor Details- 
RegexToolpublic RegexTool()
 
- 
- 
Method Details- 
findFinds the matches into a given content using a given regular expression- Parameters:
- content- the content to parse
- regex- the regex to look for in the passed content
- Returns:
- empty list if the passed regex doesn't match the content or
         several RegexTool.RegexResultobjects containing the matched position and matched content for all capturing groups, the first group representing the whole . The first object is represents the entire pattern
 
- 
findAllFinds the matches into a given content using a given regular expression- Parameters:
- content- the content to parse
- regex- the regular expression to look for in the passed content
- Returns:
- an empty list if the passed regular expression doesn't match the
         content, several RegexTool.RegexResultobjects containing the matched position and matched content for all capturing groups and sub-groups otherwise
 
- 
compileCompiles a regular expression into a javaPatternobject.- Parameters:
- regex- the textual representation of the regular expression
- Returns:
- the Patternobject corresponding to the regular expression, ornullif the expression is invalid
- Since:
- 8.7.4
 
- 
quoteReturns a literal patternStringfor the specifiedString.This method produces a Metacharacters or escape sequences in the input sequence will be given no special meaning.Stringthat can be used to create aPatternthat would match the stringsas if it were a literal pattern.- Parameters:
- s- The string to be literalized
- Returns:
- A literal string replacement
- Since:
- 8.7.4
 
- 
quoteReplacementReturns a literal replacementStringfor the specifiedString. This method produces aStringthat will work as a literal replacementsinString#replaceAll(regularExpression, s). TheStringproduced will match the sequence of characters instreated as a literal sequence. Slashes ('\') and dollar signs ('$') will be given no special meaning.- Parameters:
- s- the string to be literalized
- Returns:
- a literal string replacement
- Since:
- 8.7.4
 
 
-