en:midx [BASIC 256 - Language Documentation]

# BASIC 256 - Language Documentation

en:midx

## MidX (Function)

### Format

midx ( haystack_expr , regex_expr )
midx ( haystack_expr , regex_expr , start_expr )

returns string_expr

### Description

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

### 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, Lower, MD5, Mid, Midx, Replace, Replacex, Right, String, Upper

### History

1.1.2.7 | New To Version

en/midx.txt · Last modified: 2014/08/06 20:16 by admin