RegEx Extension Documentation
Overview
The RegEx (Regular Expression) extension is a component for use with the MIT App Inventor platform. It allows you to perform regular expression searches in text, providing the capability to find either the first occurrence or all occurrences of a specified pattern in the input text.
Open source code and examples are in the RegEx Codeberg repository.
Version: 2
Author: Eric M. Kok (appsbeheerder)
Description
The RegEx extension provides the following functionality:
- Searching for Matches: You can use regular expressions to search for matches in a given input text.
- Find All Occurrences: You have the option to find all matching occurrences in the input text or just the first one.
Component Properties
This extension does not expose any visible properties, as it's intended for use in the background.
Blocks
RegEx
- searchInText (text): The input text in which you want to search for matches.
- searchPattern (text): The regular expression pattern to search for.
-
FindAll (boolean): If set to
true
, the extension will find all matching occurrences. If set tofalse
, it will find the first occurrence.
Returns
- If "Find All" is set to
true
, this block returns a comma-separated string of all matching occurrences in the input text. - If "Find All" is set to
false
, it returns the first matching occurrence. - If no match is found, it returns an empty string."
MatchesRegEx
- searchInText (text): The input text in which you want to search for matches.
- searchPattern (text): The regular expression pattern to search for.
Returns
- Return
true
if a match occurs after searching andfalse
if there is no match.
Example Usage
Here's an example of how to use the RegEx extension to find matches:
searchInText: The quick brown fox jumps over the lazy dog, because the dog does not jump. 12345 67890
searchPattern: \b\w{5,}\b
FindAll: True
Result: quick, brown, jumps, 12345, 67890
Example app
Permissions
This extension does not require any specific permissions.
Dependencies
This extension does not depend on any external libraries.
Licensing
This extension is provided under the following license:
-
Β©Eric M. Kok (appsbeheerder)
-
License: LGPL3 - GNU Lesser General Public License version 3
-
You are allowed to use the .aix (jar) extension RegEx, as part of an MIT Appathon app. https://appathon.appinventor.mit.edu/
Extension UUID: 6e2af0a0-259f-46e3-81d9-dd2e8e346dc3