[F/OS] Regular Expressions βœ’ Extension

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.

RegEx V2 extension (AIX)

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

codeblock_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 to false, 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

codeblock_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 and false if there is no match.

Example Usage

Here's an example of how to use the RegEx extension to find matches:
codeblock_regex_example

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

RegEx V2 (AIA)
RegEx V2 (APK)

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
    LGLG_V3

  • You are allowed to use the .aix (jar) extension RegEx, as part of an MIT Appathon app. https://appathon.appinventor.mit.edu/
    IMG_20231027_182631

Extension UUID: 6e2af0a0-259f-46e3-81d9-dd2e8e346dc3

5 Likes

Topic not visible until links are updated.