This extension provides basic RegEx execution capabilities to Siddhi. Following are the functions of the RegEx extension.
Find function
Syntax | <bool> regex:find (<string> regex , <string> inputSequence ) |
---|---|
Extension Type | Function |
Description | This method attempts to find the next sub-sequence of the inputSequence that matches the regex pattern. It returns true if such a sub sequence exists, or returns false otherwise. |
Examples |
|
Syntax | <bool> regex:find (<string> regex , <string> inputSequence, <int> startingIndex ) |
---|---|
Extension Type | Function |
Description | This method attempts to find the next sub-sequence of the inputSequence that matches the regex pattern starting from given index (i.e. startingIndex ). It returns true if such a sub sequence exists, or returns false otherwise. |
Examples |
|
Group function
Syntax | <string> regex:group (<string> regex , <string> inputSequence , <int> groupId ) |
---|---|
Extension Type | Function |
Description | Returns the input sub-sequence captured by the given group during the previous match operation. Returns null if no sub-sequence was found during the previous match operation. For more information about the match operation, see matches. |
Example | group("(\d\d)(.*)(WSO2.*)", "21 products are produced within 10 years by WSO2 currently by WSO2 employees", 3) returns "WSO2 employees" . |
Looking At function
Syntax | <string> regex:lookingAt (<string> regex , <string> inputSequence ) |
---|---|
Extension Type | Function |
Description | This method attempts to match the inputSequence against the regex pattern starting at the beginning. |
Examples |
|
Matches function
Syntax | <string> regex:matches (<string> regex , <string> inputSequence ) |
---|---|
Extension Type | Function |
Description | This method attempts to match the entire inputSequence against the regex pattern. |
Examples |
|
Overview
Content Tools
Activity