Hi,
first please excuse me for replying so late. Thanks to all who responded.
I am using now (?i)^([a-z0-9]{2})\.([a-z0-9]{5})\.([a-z0-9]{3})$ for checking
the format, because each char can be alpha or number.
And it shows me again, i should have read Mastering regular expressions from
Dear all,
i have to check for an value in the format XX.Y.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
It would be good to know where the numbers and letters are if that's
possible. But this will get you going:
local tXX
local tY
local tZZZ
## just a simple unit test
get A1.B35AZ.001
## do the match
if matchText(it, ([a-z0-9]{2})\.([a-z0-9]{5})\.([a-z0-9]{3}), tXX, tY,
tZZZ) is true then
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
Just a small correction to your regular expression Jeff to make it case
insensitive as it ignores the caseInsensitive global property and also assuming
that Mathias doesn't want to match chunks of longer strings I've added the ^
$:
(?i)^([a-z0-9]{2})\.([a-z0-9]{5})\.([a-z0-9]{3})$
Cheers
Ever since those aliens landed... err... crashed that's right they crashed...
life has gotten way too dang complicated!
Bob
On Nov 4, 2010, at 2:40 PM, Monte Goulding wrote:
Just a small correction to your regular expression Jeff to make it case
insensitive as it ignores the
Hints to help you
(?i) means case insensitive
[a-z] means a single lower case alpha char
[A-Z] means a single upper case alpha char
[0-9] means a single digit
(?i)^[a-z][0-9]\.[a-z][0-9][0-9][a-z][a-z]\.[0-9][0-9]$
means
upper or lower case for all matches
\. means a literal period character
^
Okay this is going into my keepers file. Very useful. Wish the regex tuorials
out there were explained this simply.
Bob
On Nov 4, 2010, at 2:56 PM, Jim Ault wrote:
Hints to help you
(?i) means case insensitive
[a-z] means a single lower case alpha char
[A-Z] means a single upper case