Posted by Rik on 04/28/07 15:52
Anthony Smith wrote:
> I have data that is in this format: 8-8-19-29-1-4-41
> I wanted to write a simple function or regular expression that
> verified that data is in that format. The numbers should only be 1 or
> 2 digits. There should be 6 dashes (-) with 7 numbers around the
> dashes. Here are examples of bad data:
>
>
> 8-19-29-1-4-41 (Only 6 dashes)
> 5-1-2-3-4-S-67-4 (Includes a letter)
> 5-1-2-3-4-222-67-4 (has three digits in one space)
Regex is one way to go, depending on the source, fscanf() can be your
friend too.
--
Rik Wasmus
Estimated date being able to walk again: 01-05-2007.
Less then a week, hurray!
Navigation:
[Reply to this message]
|