OT: Some help with Regular Expressions

Matthias Rebbe runrev260805 at m-r-d.de
Mon Nov 8 14:40:48 EST 2010


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 J.Friedl. I own this book , but did not have the time yet to read it. (I know i own it, but i do not know where it is at the moment) ;-).

Thanks again,

Matthias


Am 04.11.2010 um 22:44 schrieb Bob Sneidar:

> 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 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
>> 
>> Monte
>> 
>> On 05/11/2010, at 6:57 AM, Jeff Massung wrote:
>> 
>>> 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 tYYYYY
>>> 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, tYYYYY,
>>> tZZZ) is true then
>>> put tXX & cr & tYYYYY & tZZZ
>>> end if
>>> 
>>> If you need it to be more specialized (eg, the format is really:
>>> A#.A##AA.### where A=alpha and #=number) then let me know and I can get a
>>> better matching pattern for you.
>>> 
>>> Jeff M.
>>> 
>>> On Thu, Nov 4, 2010 at 1:48 PM, Matthias Rebbe <runrev260805 at m-r-d.de>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?
>> 
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list