paul j3 added the comment:
The usage formatting is fragile, with many associated bug reports. Until
someone does a major rewrite, it is best to avoid special characters,
especially `()` and `[]` in the `dest` or `metavar`.
Usage uses () to encolde mutually_exclusive_groups and [] to mark
Nikita Sobolev added the comment:
Maybe instead we can show users something like:
```
usage: ex.py [-h] (-p '/var/www/html' | -r 'http)s(://Host:Port') [--last-args
LAST_ARGS]
```
?
--
components: +Library (Lib) -Parser
type: -> behavior
versions: +Python 3.10, Python 3.11
Nikita Sobolev added the comment:
I confirm this happens on all recent Python versions.
The source of this problem is that `argparse` uses `regex` module to replace
some substrings. Direct link:
New submission from AbcSxyZ :
Hi,
I'm getting a kind of undefined behavior where parenthesis seem handled in a
strange way. On display, it has a conflict between parenthesis of the option,
and nested parenthesis within a metavar.
## Reproduction script
```
import argparse
def main():