Results 1 to 2 of 2
  1. #1
    hiklior is offline Member
    Join Date
    Apr 2008
    Posts
    9
    Rep Power
    0

    Default Complex Regular Expression HELP

    Condition:
    Print error message if 5 consecutive zeros are found in front or back of a chunk of 5 integers >=50.
    Numbers are counted in a chunk of 5

    Example
    000000005000000000210005200000000250000000056

    Lets put commas in between chunks of five to make the problem simpler

    00000,00050,00000,00021,00052,00000,00025,00000,00 056

    There is 5 consecutive zero in front of 00050 - Println"error" (condition met 00000 in front and 00050>=50)

    There is 5 consecutive zeros back of 00050- print error(condition met 00000 in back and 00050>=50)

    Even though there is 5 consecutive zeros in front of 00021 it does not count (condition failed because that chunk of zero is already associated with 00050 and also 00021 is not >=50 )

    There is 5 consecutive zero back of 00052- print error (Condition met 00000 in the back and 00052 is >=50)

    00000,00050,00000,00021,00052,00000,00025,00000,00 056

    Even though there is 5 consecutive zeros in front and back of 00025 it does not matter (condition failed because 00025 in not >=50 and also that front chunk of zero was already associated with 00052)

    There is 5 consecutive zeros in front of 00056 - print error (condition met because there is 00000 in front of 00056 and 00056>=50 and that chunk of zero was not associated with 00025 because 00025 was not >=50)

    I hope this explains a little bit more clearely.

    A regular expression would help or any logic will be appreciated.

  2. #2
    sukatoa's Avatar
    sukatoa is offline Senior Member
    Join Date
    Jan 2008
    Location
    Cebu City, Philippines
    Posts
    556
    Rep Power
    10

    Default

    What have you done so far?

    regards,
    sukatoa
    freedom exists in the world of ideas

Similar Threads

  1. Regular Expression Challange
    By hiklior in forum New To Java
    Replies: 2
    Last Post: 04-24-2008, 05:05 AM
  2. regular expression for unicode
    By tharhan in forum Advanced Java
    Replies: 0
    Last Post: 04-01-2008, 10:53 PM
  3. Regular expression with Unions
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-09-2008, 01:03 PM
  4. Regular expression with Intersections
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-09-2008, 01:03 PM
  5. I can't find the right regular expression
    By romina in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 05:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •