$basename (parse-spec) function


The portion of the word given by parse-spec is returned, where the returned portion is delimited by the last punctuation mark of the word (if any).  If the parse-spec value does not return a word, the match specification is not matched. This function is especially useful in a nested specification. For a similar function, useful for finding the basename of file paths, see the $fname() function. (See further section.)

Target string

Parse expression

Return value

File README

$basename($2)

readme

File Readme.txt

$basename(file *)

readme

Test Addr: 192.168.1.31.0

$basename(addr: *)

192.168.1.31

Test Addr: 10.1.1.38/25

$basename(addr: *)

10.1.1.38

Test Addr: /10.1.2.3/00/35

$basename(addr: *)

/10.1.2.3/00

Test string ABC.

$basename($3)

ABC

Test string AAA

$basename($4)

No match. There is no fourth word in the string.

Test string value

$basename(xxx: *)

No match. There is no match for XXX: * in the target string.

Related topic


 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*

BMC AMI Command Center for Security 5.9