Reputation: 23
I've different types of drawing numbers, and i have to select some specific drawing numbers. I'd like to know if it is possible using regular expressions to match any numbers except full of zeros?
Here is an example:
5635/13-500-00-00-000/a - Type 1 assy drawing
5635/13-500-00-00-010/a - Type 1 production drawing
The drawing number contains group of numbers divided by "-". The digits of the groups >=2.
The difference is the last group of numbers (000 vs 010).. if last group of numbers is full of zeros, that is an "assy drawing", if not but this group is full of numbers, that is a "production drawing".
For assy drawings this works fine:
^\d{3,5}\/\d{2}(\-\d{2,})+(\-0{2,})\/\D$
^
\d{3,5} 3-5 digit number
\/ /
\d{2} 2 digit number
(\-\d{2,})+ (minus sign followed by >=2 digit number) any times
(\-0+) minus sign followed by >=2 zero number
\/ /
\D one non digit character
$
But what I have to put into this regexp to match "production drawing"?
Upvotes: 2
Views: 1035
Reputation: 71538
Your detailed regex doesn't exactly look like your initially mentioned regex, oh well.
For the production drawing, you could use this:
^\d{3,5}/\d{2}(-\d{2,})+(-[0-9]*[1-9]+[0-9]*)/\D$
It will match numbers, and at least one non-zero number.
And you shouldn't need to escape forward slashes in VBA, but just in case...
^\d{3,5}\/\d{2}(-\d{2,})+(-[0-9]*[1-9]+[0-9]*)\/\D$
Upvotes: 1