Android Programming Press on the image to return to the main documentation page.

Regular Expressions (Core)

List of types:

Matcher
Regex

Matcher

A Matcher object is used to search for a pattern in a string.

Events:

None

Members:


  Find As Boolean

  GetEnd (Index As Int) As Int

  GetStart (Index As Int) As Int

  Group (Index As Int) As String

  GroupCount As Int [read only]

  Match As String [read only]

Members description:

Find As Boolean
Searches for the next substring that matches the pattern.
Returns True if a match was found.
GetEnd (Index As Int) As Int
Returns the end offset of the specified captured group.
GetStart (Index As Int) As Int
Returns the start offset of the specified captured group.
Group (Index As Int) As String
Returns the captured group with the specified index. Group 0 returns the full match.
GroupCount As Int [read only]
Returns the number of groups.
Match As String [read only]
Returns the matched string (same as Group(0)).

Regex

Regex is a predefined object that contains regular expressions related methods.
All methods receive a 'pattern' string. This is the regular expression pattern.

Events:

None

Members:


  CASE_INSENSITIVE As Int [read only]

  IsMatch (Pattern As String, Text As String) As Boolean

  IsMatch2 (Pattern As String, Options As Int, Text As String) As Boolean

  Matcher (Pattern As String, Text As String) As Matcher

  Matcher2 (Pattern As String, Options As Int, Text As String) As Matcher

  MULTILINE As Int [read only]

  Replace (Pattern As String, Text As String, Template As String) As String

  Replace2 (Pattern As String, Options As Int, Text As String, Template As String) As String

  Split (Pattern As String, Text As String) As String()

  Split2 (Pattern As String, Options As Int, Text As String) As String()

Members description:

CASE_INSENSITIVE As Int [read only]
Enables case insensitive matching.
IsMatch (Pattern As String, Text As String) As Boolean
Tests whether the given text is a match for the given pattern.
The whole text should match the pattern. Use matcher to search for a substring that matches the pattern.
Note that it will return False for empty strings.
IsMatch2 (Pattern As String, Options As Int, Text As String) As Boolean
Similar to IsMatch. Allows you to set the pattern options.
Matcher (Pattern As String, Text As String) As Matcher
Creates a Matcher that can be used to search for matching substrings in the text.
Matcher2 (Pattern As String, Options As Int, Text As String) As Matcher
Similar to Matcher. Allows you to set the pattern options.
MULTILINE As Int [read only]
Changes ^ and $ to match the start and end of each line instead of the whole string.
Replace (Pattern As String, Text As String, Template As String) As String
Replaces all the matches in the text based on the specified pattern and template.
Replace2 (Pattern As String, Options As Int, Text As String, Template As String) As String
Similar to Replace. Allows you to set the pattern options.
Split (Pattern As String, Text As String) As String()
Splits the text to an array of strings based on the given pattern.
Split2 (Pattern As String, Options As Int, Text As String) As String()
Similar to Split. Allows you to set the pattern options.
Top