Why not do it in LiveCode rather than using regex? Assuming that the 3rd and 9th char of a properly formatted string must be a period, and all other chars must be alphanumeric:

constant alphNumChars = "abcdefghijklmnopqrstuvwxyz0123456789"
constant alphNumPlaces = "1,2,4,5,6,7,8,10,11"

function testFormat strg
   -- format should be: XX.YYYYY.ZZ
   if length(strg) <> 11 then return false
   if char 3 of str <> "." then return false
   if char 9 of strg <> "." then return false
   repeat for each item i of alphNumPlaces
      if char i of strg is not in alphNumChars then return false
   end repeat
   return true
end testFormat

call it with:

   if testFormat(tInput) then
      -- valid string, do whatever
   else
      -- invalid string, do something else
   end if

-- Peter

Peter M. Brigham
[email protected]
http://home.comcast.net/~pmbrig


On Nov 4, 2010, at 3:48 PM, Matthias Rebbe wrote:

Dear all,

i have to check for an value in the format XX.YYYYY.ZZZ (e.g. A1.B35AZ.001 or a1.b35az.001) I have to check if the value is in the right format. I know i can do that with matchtext and a regular expression, but
i do not know enough to get the regular expression to work.

Is there anyone who might be able to help?

Regards,

Matthias


_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to