Skip to main content

Midx

MidX (Function)​

Format​

midx ( haystack_string_expression , regular_expression )
midx ( haystack_string_expression , regular_expression , start_expression )

returns string_expression

Description​

Returns the first substring that was matched by the regular expression. If the expression does not match anything the empty string “” will be returned. You may also specify an optional starting location for the search to begin start_expression.

Note​

String indices begin at 1.

Example​

print midx("HeLLo", "[Ll]o")
print midx("Hello, Kitti","[Ii]",10)

will display

Lo
i

Notes​

By default the nature of regular expressions is “greedy”. This behaviour can be changed using the RegexMinimal statement.

See Also​

Asc, Chr, Count, Countx, Explode, Explodex, Implode, Instr, Instrx, Left, Length, Ljust, Lower, LTrim, MD5, Mid, Midx, Replace, Replacex, Right, Rjust, RTrim, Serialize, String, Trim, Unserialize, Upper, Zfill

History​

1.1.2.7New To Version
1.99.99.53Added start position < 0