Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-30-2008, 01:43 AM
Member
 
Join Date: Apr 2008
Posts: 9
hiklior is on a distinguished road
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.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-30-2008, 03:52 PM
sukatoa's Avatar
Senior Member
 
Join Date: Jan 2008
Location: Cebu City, Philippines
Posts: 527
sukatoa is on a distinguished road
Send a message via Yahoo to sukatoa
What have you done so far?

regards,
sukatoa
__________________
A specific, detailed, simple, well elaborated, and "tested before asking" question may gather more quick replies. hopefully
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Regular Expression Challange hiklior New To Java 2 04-24-2008 07:05 AM
regular expression for unicode tharhan Advanced Java 0 04-02-2008 12:53 AM
Regular expression with Unions Java Tip Java Tips 0 01-09-2008 02:03 PM
Regular expression with Intersections Java Tip Java Tips 0 01-09-2008 02:03 PM
I can't find the right regular expression romina New To Java 1 08-07-2007 07:36 AM


All times are GMT +3. The time now is 05:42 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org