in reply to Need Set-like Regex for Perl and Java (golf OK)

I'm a little fuzzy on exactly what it is you want to match. In the example set you gave

[A000,A123-A456,A999-B000,B789-B888]

are you looking to match A000 and A456-A999, but NOT A999-B000? If you want the second one (A456-A999) matched, do you want it matched as A456 and A999 or as A456-A999?

davidj

Replies are listed 'Best First'.
Re^2: Need Set-like Regex for Perl and Java (golf OK)
by QM (Parson) on Jun 09, 2004 at 18:34 UTC
    Sorry. I assumed that everyone KWIM (Knew What I Meant), which wasn't the case.

    The Perl list

    ( 'A000','A123'..'A456','A999'..'B000','B789'..'B888' )
    does this nicely (unless I typoed, in which case it doesn't).

    -QM
    --
    Quantum Mechanics: The dreams stuff is made of