I would like to create a regular expression that matches A
, B
, and AB
, where A
and B
are quite complex regular expressions.
One solution is to use (A|A?B)
or (AB?|B)
, but then I have to repeat one of the expressions.
A?B?
does not work, since this also matches the empty string.
Is it possible to create this regular expression without repeating neither A
nor B
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…