I now have the grammar and PERL regex as below. This is slightly
improved (I believe) from Peter's last version.
archetype_id: qualified_rm_entity ?.? domain_concept ?.? version_id
qualified_rm_entity: rm_originator ?-? rm_name ?-? rm_entity
rm_originator: V_NAME
rm_name: V_NAME
rm_entity: V_NAME
domain_concept: concept_name { ?-? specialisation }
concept_name: V_NAME
specialisation: V_NAME
version_id: ?v? V_NONZERO_DIGIT [ V_NUMBER ] [ ?.? V_NUMBER [ ?.?
V_NUMBER ] ]
V_NONZERO_DIGIT: [1-9]
V_DIGIT: [0-9]
V_NUMBER: [0-9]*
V_NAME: [a-zA-Z][a-zA-Z0-9_]+
The PERL regular expression equivalent of the above is as follows:
[a-zA-Z]\w+(-[a-zA-Z]\w+){2}\.[a-zA-Z]\w+(-[a-zA-Z]\w+)*\.v[1-9]\d*(\.\d+){0,2}
Peter Gummer wrote:
> Thomas Beale wrote:
>
>>> v1.1.1.1 -- or even more than three parts?
>>>
>> yes you are right - we probably should limit it to 3, which will
>> require a change
>>
>>
>>> The version_id regex rejects these: ...
>>> v1.10 -- surely this should be allowed!
>>>
>> yes - that's an error. I think this part of the regex should be:
>>
>> .v[1-9]\d*(\.[0-9]+){0,2}
>>
>
> Ok, so in Perlesque it would be:
>
> v[1-9]\d*(\.\d+){0,2}
>
> And the "classic regular expression equivalent" would be:
>
> v[1-9][0-9]*(\.[0-9]+){0,2}
>
> Therefore, the production rule would be:
>
> version_id: 'v' V_NONZERO_DIGIT { V_DIGIT } [ '.' V_DIGIT { V_DIGIT } ]
> [ '.' V_DIGIT { V_DIGIT } ]
> V_DIGIT: [0-9]
> V_NONZERO_DIGIT: [1-9]
>
> - Peter
>
>
> _______________________________________________
> openEHR-technical mailing list
> openEHR-technical at openehr.org
> http://lists.chime.ucl.ac.uk/mailman/listinfo/openehr-technical
>
>
>
--
*Thomas Beale
Chief Technology Officer, Ocean Informatics
<http://www.oceaninformatics.com/>*
Chair Architectural Review Board, /open/EHR Foundation
<http://www.openehr.org/>
Honorary Research Fellow, University College London
<http://www.chime.ucl.ac.uk/>
*
*