Xbasic

REGEX_SPLIT Function

Syntax

New_Text as C = REGEX_SPLIT( text as c , RegExp as c [,format as c[,options as c]])

Arguments

New_Text

The function modified text.

text

The character string to examine. The parentheses characters " ( " and " ) " have special meaning. If present, they enclose a regular expression argument. If you want parentheses characters to be part of the text, you must precede them with " \ " characters.

RegExp

A regular expression that contains one or more search arguments. Refer to for detailed information.

format

Character

options

Character

Description

Extract regular expression tags. options same as regex_match.

Discussion

The REGEX_SPLIT() function searches Text for one or more matches to Search_Expression and returns each matching string on its own line. Search_Expression can have multiple search arguments (separated by '|' characters).

Example

The following example has one regular expression search argument: [a-z]+. Its meanings is: any number of alphabetic characters.

? regex_split("some strings 1 2","([a-z]+)")
= some
strings

The following example has two regular expression search arguments separated by the " | " character: [a-z]+ and [0-9]+. Their meanings are: any number of alphabetic characters and any number of numeric characters.

? regex_split("one 12312 word ? some1","([a-z]+|[0-9]+)")
= one
12312
word
some
1

See Also