As you said, you want \1 working as the first captured occurrence in a character class ([...]). But \1 can capture much more than a single character, so, it can't be used inside a character class because it doesn't represent a character, but a string. To match multiple strings just use (?:...|\1|...).

Graciliano M. P.
"Creativity is the expression of the liberty".

In reply to Re: \1, \2, \3, ... inside of a character class by gmpassos
in thread \1, \2, \3, ... inside of a character class by ccn

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":