extglob can match a number of regex constructs (pattern-list
is a list of alterations):
extglob regex
-------------- -----------------
? [^/]
* [^/]*
. \.
** .
?(pattern-list) (pattern-list)?
*(pattern-list) (pattern-list)*
+(pattern-list) (pattern-list)+
@(pattern-list) (pattern-list)
!(pattern-list) (?!pattern-list)
There are some things that regex does that cannot be done in extglob, as far as I know, too:
?????????????? [^abc]
?????????????? \1
?????????????? most look arounds
Assuming all of the constructs in the regex have extglob equivalents, it would be possible to convert it to extglob form. It would be difficult, because regexes are represented by a CFG. And you're using Java, which forces you to use the evil escaped escape \\
.
Why not just use a different bash utility that supports regexes? Like this.