Ad
  • Custom User Avatar

    I agree that making the problem "too easy" is likely why lookaheads aren't allowed, but if that is the case I think it should be made explicit in the description. Seems a little silly to me to ask for a program that generates a regex for binary divisibility by n, and then in the fine print you can deduce on your own that it bans a fairly standard feature to make the problem harder. Just say it up front if that is the case.

  • Custom User Avatar

    With "?=" you could implement kind of "and" logic, which will make the problem easier, since numbers, which and divisible by 6 are divisible by 2 and by 3.

    For the quantifiers I agree with you, they would be handy. On the other hand: this is probably nothing, what is generated "automatically", this would be an outcome of some kind of optimization, but - if I understood it correctly - the goal is to generate the regex on the fly.
    (tivia: if allowing quantifiers, all digits needs to be allowed as well.)

  • Custom User Avatar

    Is the allowed character set ( 01?:*+^$()[]| ) accurate?

    This disallows positive lookaheads (?= .... ), which requires the '=', and quantifiers {1,3}, which require '{},', both of which are valid in the Javascript regex engine.

    If those characters (and implicitly, the lookahead and quantifier features) are in fact allowed, the allowed character set should be updated.

    If they are (intentionally) not allowed, it would be nice if the description made that clear and explained why -- they are both very standard regex features and the description does not mention limitting which regex features the answer should use. I wouldn't think that they fall under 'funny business', so I am unsure why they would be forbidden.

    And obviously if they are unintentionally not allowed that should be fixed.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution