Re: Regex exactly 0, 1 or 2 matches, {0,2} not working



I was really hoping to keep it as a pure regular expression. What I've
ended up doing was having a boatload of different expressions, EX: one
with a comma, 1 with a comma and a space, one with a comma, space and
number 1-9, and one with a comma, space, number 1-9 and 0-5 and one
with all that and a-f after it. I also have one with - or --. It's
ugly. Now here's the kicker. The numbers are not allowed to be
identical!

So 1a, 2b is OK, but 1a, 1f is not!

I have absolutely no idea how to implement that unless I use a program.

So basically how can you make a regular expression with 2 DIFFERENT
numbers?

I thought there was some backreference thing you could use, but I can't
seem to get it to work.

So say 1,5 or 1,3 or 1,7 but not 2,2 or 1,1.

AURGH!

.



Relevant Pages

  • attn: regex gurus. can this be done with a regular expression or using a different technique?
    ... I need to switch *whatever* appears before the comma with ... *whatever* appears after the comma. ... If this code revision is not possible with a regular expression, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Regular Expression Help
    ... | I need to find all occurrences of a comma in a string EXCEPT where it ... | I figured a regular expression would be the way to go, ... | Kind of like the wizard that helps you build a connection string? ... | of various RegEx test programs, but I would like one to help me construct ...
    (microsoft.public.dotnet.languages.vb)
  • Re: RegularExpression Validation for password in ASP.NET
    ... Can any one help me to write a regular expression to validate the password ... 3- Password must begin with an alphabetic character. ... single quote, double quotes, comma). ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Regular Expression
    ... On Tue, 2 Jan 2007, zowtar wrote: ... You seem to be using a comma for alternation--that is to specify one of ... HOWEVER, you specify ... If I were writing a regular expression to pluck out the URLs in your ...
    (comp.lang.tcl)
  • Regular Expression Help
    ... I need to find all occurrences of a comma in a string EXCEPT where it ... I figured a regular expression would be the way to go, ... of various RegEx test programs, but I would like one to help me construct ...
    (microsoft.public.dotnet.languages.vb)