Bruno Haible <[email protected]> ha escrit:
> Why does it not fit into two regexes / DFAs?
Yes, it would, provided that we translate fnmatch patterns to regexps.
> EXCLUDE_WILDCARDS on: 'a?b*' -> 'a.b.*'
> EXCLUDE_WILDCARDS off: 'a?b*' -> 'a[?]b[*]'
> EXCLUDE_ANCHORED on: 'a?b' -> '^a.b$'
> EXCLUDE_ANCHORED off: 'a?b' -> '^\([^/]*/\)*a.b$'
There is also FNM_LEADING_DIR, which translates to
'a?b' -> '^a.b/.*'
> The DFA code from grep and gawk is next to unmaintainable [1].
That is exactly the main obstacle :)
Regards,
Sergey