[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
match(s,r)                   match regular expression

    Return TRUE/FALSE if  string s contains  a substring matched  by r. Set
    RLENGTH to length  of substring matched  (or zero) and  RSTART to start
    position of substring matched (or zero).  For example, given a complete
    path specification with drive,  path and filename with  extension, find
    the filename and extension:

        # characters excluded from filename
    exc_c = /[!\x01-\x21."\/\\\[\]:|<>+=;,]/;
        # DOS filename.ext pattern
        # filename consists of all characters not excluded from proper name
        # followed by optional extension of 1 to 3 characters
        # followed by end of string
    name_pat = /{exc_c}+(.{exc_c}{1,3})?$/;

    match("a:\toolsdir\expressions\awkplus.exe",name_pat) ==> TRUE

    RSTART  == 25
    RLENGTH == 12 (Note: ending '$' operators included)

See Also: gsub sub
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson