Regular Expressions

Dear all, I want to have an field which only takes 3 letters,
all uppercase. I have implemented the regex thus, but it allows more
than 3 characters to be filled:

		<bind nodeset="/data/anthroMeasurementsGroup/staffId" type="string"

constraint="regex(.,'[A-Z]{3}')" jr:constraintMsg="Tumia herufi kubwa
tafadhali, kwa mfano TNK." required="true()" />

Is it a syntax issue?

Thanks in advance,
Tumaini

That regex will match any three or more uppercase letters, including
"ABCD". If you want to have only three letters, try
"regex(.,'^[A-Z]{3}$')"

··· On Mon, May 21, 2012 at 5:58 AM, Tumaini Kilimba wrote: > Dear all, I want to have an field which only takes 3 letters, > all uppercase. I have implemented the regex thus, but it allows more > than 3 characters to be filled: > > > constraint="regex(.,'[A-Z]{3}')" jr:constraintMsg="Tumia herufi kubwa > tafadhali, kwa mfano TNK." required="true()" /> > > Is it a syntax issue? > > Thanks in advance, > Tumaini > > -- > Post: opendatakit@googlegroups.com > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > Options: http://groups.google.com/group/opendatakit?hl=en

Thanks Yaw

··· On Mon, May 21, 2012 at 4:44 PM, Yaw Anokwa wrote:

That regex will match any three or more uppercase letters, including
"ABCD". If you want to have only three letters, try
"regex(.,'[1]{3}$')"

On Mon, May 21, 2012 at 5:58 AM, Tumaini Kilimba tkilimba@ihi.or.tz wrote:

Dear all, I want to have an field which only takes 3 letters,
all uppercase. I have implemented the regex thus, but it allows more
than 3 characters to be filled:

                   <bind

nodeset="/data/anthroMeasurementsGroup/staffId" type="string"

constraint="regex(.,'[A-Z]{3}')" jr:constraintMsg="Tumia herufi kubwa
tafadhali, kwa mfano TNK." required="true()" />

Is it a syntax issue?

Thanks in advance,
Tumaini

--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en

--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


  1. A-Z ↩︎