$ 0 0 ^(? .*)-(? .*)-(? .*)-(? .*)|(? .*)-(? .*)-(? .*) this is compatible for both cases. PS1-AAA-BB-CC or PS2-AAA-BB