# REGEXP

Updated: 10/19/2021, 9:29:48 PM
Created: 10/19/2021, 9:29:48 PM
Last Updated By: Kevin Munoz
Read Time: 1 minute(s)

Tags: extended pattern matching unix string handling

# Description

The REGEXP function is a powerful function that allows pattern matching using UNIX regular expressions.

REGEXP is not supported on Windows.

It takes the general form:

REGEXP(variable, expression)
1

Where:

  • variable can be any type of jBASE BASIC variable and is the variable upon which pattern matching will be performed.
  • expression should evaluate to a standard UNIX regular expression as defined in the UNIX documentation.

The function returns a numeric integer value being the first character in variable that failed to match the specified regular expression. If a match is not found or the regular expression was invalid then the function returns 0.

An example of use would be:

String = "jBASE Software Inc."
CRT REGEXP(String, "S[^t]*")
1
2

to display the value 4, being the position of the character "t" in the word Software

Go back to jBASE BASIC

Go back to Programmers' Reference Guide