20.4. Ambiguous matching

[<<<] [>>>]

Pattern matching is not always as simple as it seems to be from the previous examples. The pattern "*.*" matches files having extension and joker(1) and joker(2) can be used to retrieve the file name and the extension. What about the file sciba_source.tar.gz? Will it result

File=scriba_source.tar extension=gz

or

File=scriba_source extension=tar.gz

?

The correct result is the second. Wild card characters implemented in ScriptBasic are not greedy. They eat up only as many characters as they need. If you need more flexibility then you have to use the more complex module RE that implements regular expression search and replace.


[<<<] [>>>]