# Regular Expressions problem

• 01-04-2011, 09:52 PM
mohammedelbes
Regular Expressions problem
Hi

can anybody help me write a regular expresion for a string like this

"X,Y,Z,A,B,C,Time"

X,Y,Z,A,B,C is a 3 digits number

Time is a double value with anynumber of digits with two decimal places.

Thank you very much
• 01-05-2011, 08:25 AM
Well, where's your attempt at it? See the API docs for Pattern for the symbols available and google for a regex tutorial (does not need to be a Java regex tutorial, simply regex). After you post your attempt we will help you correct it. I would, however, suggest simply using the split method of String.
• 01-05-2011, 08:45 AM
JavaHater
Quote:

Originally Posted by mohammedelbes
Hi

can anybody help me write a regular expresion for a string like this

"X,Y,Z,A,B,C,Time"

X,Y,Z,A,B,C is a 3 digits number

Time is a double value with anynumber of digits with two decimal places.

Thank you very much

here's something for you to start with (this can be further simplified, but let's not make it too complicated first)
Code:

`"\d{3},\d{3},\d{3},\d{3},\d{3},\d{3},\d+\.\."`
Note:, you still have to escape what is necessary for it to work.
• 01-05-2011, 09:05 AM
Well, the last part definately won't work.
• 01-05-2011, 10:16 AM
JavaHater
yes, it won't work ( cos it for OP to find out :) )
• 01-05-2011, 11:32 AM