in reply to HELP! I am in regex-hell

use character classes or or conditions | to include the missing characters

But your regex seems wrong anyway, since there is a space in between

DB<1> $line = 'Cache::Cache(3)' DB<2> x ($page , $section) = ( $line =~ /^((?:\w|:|-)+)(\(.*?\))?/) 0 'Cache::Cache' 1 '(3)' DB<3> $line = 'dhcp-config(5)' DB<4> x ($page , $section) = ( $line =~ /^([\w:-]+)(\(.*?\))?/) 0 'dhcp-config' 1 '(5)' DB<5>

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^2: HELP! I am in regex-hell
by Anonymous Monk on Jul 15, 2020 at 20:35 UTC

    Eh Rolf -- thanks! I messed with the following line:

    ($page , $section) = ( $line =~ /^((?:\w|:|-)+)(\(.*?\))?/)

    This did what I wanted. I needed to keep "\(.*?\)" because that block is used elsewhere in the code. I found it amazing that the first chunk was so simple. I was over-complicating the matter...

Re^2: HELP! I am in regex-hell
by Anonymous Monk on Jul 15, 2020 at 12:50 UTC

    DOH! ... The space was not intended. I cant keep all those () straight while reading my code.