in reply to Double prompt in Net::Telnet
Combining regular expressions can be done by using alternation and parentheses, see perlre. But note that once you have a combined regular expression, both matches will always be tried. The better approach is to have a list of devices and the prompts to use with them. Even better is to configure all devices to have an identical prompt.
I suggest that you create a list of prompt strings to be matched and other strings not to be matched and then write a regular expression (and surrounding program) that will check whether your expression actually matches the prompts and nothing else.
Combining two regular expressions %|#|>|\\$ and [\$%#>] $ is done by wrapping each regular expression in parentheses (...) and joining these with |:
((%|#|>|\\$)|([\$%#>] $))
This expression can be simplified a bit but that should "work".
|
|---|