
App::Chart::SymbolMatch -- loose matching of symbols

use App::Chart::SymbolMatch;

This module is used for loose symbol entry on the command line and in the Open dialog (see App::Chart::Gtk2::OpenDialog). It's only a separate module to keep a tricky bit of code away from other things.

($symbol, $symlist) = App::Chart::SymbolMatch::find ($target)($symbol, $symlist) = App::Chart::SymbolMatch::find ($target, $preferred_symlist)Find a symbol for the partial string $target in the symlists and return the symbol and symlist, or return no values if nothing matches (which include when $target is the empty string "").
Progressively looser matches are attempted. So first an exact match in the given $preferred_symlist, otherwise other lists. Otherwise a case-insensitive match, or a match without suffix (but always following an explicit suffix on $target), or a partial match at the start of the symbol, and possibly without the index "^" marker.
The effect is that for instance a $target "bh" might match "BHP.AX", or "gsp" might match "^GSPC". Note that an exact match anywhere is preferred over a partial match in the current list, because otherwise you could type an exact full symbol like "FOO" and still be left on a "FOO.AX" in the current list.
