testing on case

James.Cass at sealedair.com James.Cass at sealedair.com
Fri Dec 10 11:12:27 EST 2004


Jonathan -

That's weird, right?  When I do this in the messagebox or in a button 
script:
        put matchText( z, "^[A-Z]")
I definitely get "false" returned. 

But when I do this in the messagebox
        put matchText( z, "^[aA-zZ]")
I get true.  This is the way I would expect it to behave. 

I don't know why you would be getting different results.  Hmmmm.

I'm running Rev 2.5 on MacOSX 10.3.6. 

- James





"Lynch, Jonathan" <BNZ2 at CDC.GOV>
Sent by: use-revolution-bounces at lists.runrev.com
12/09/04 04:02 PM
Please respond to How to use Revolution
 
        To:     "How to use Revolution" <use-revolution at lists.runrev.com>
        cc: 
        Subject:        RE: testing on case


Hi James...

I tried:

matchText( z, "^[A-Z]")

and it worked fine for me...



I tested it in the message box...

matchText("b","^[A-Z]")

returned false, and

matchText("B","^[A-Z]")

returned true



-----Original Message-----
From: use-revolution-bounces at lists.runrev.com
[mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of
James.Cass at sealedair.com
Sent: Thursday, December 09, 2004 3:47 PM
To: How to use Revolution
Subject: Re: testing on case

>  The expression matchText( z, "^[A-Z]")
> will return true if (and only when) the
> first character is an ASCII capital letter.

That returns "false" for me.  You'll need to do it like this to cover
upper
and lower case.

matchText(z,"^[aA-zZ]")

Cheers...James




|---------+--------------------------------------->
|         |           Dar Scott <dsc at swcp.com>    |
|         |           Sent by:                    |
|         |           use-revolution-bounces at lists|
|         |           .runrev.com                 |
|         |                                       |
|         |                                       |
|         |           12/09/04 02:53 PM           |
|         |           Please respond to How to use|
|         |           Revolution                  |
|---------+--------------------------------------->

>-----------------------------------------------------------------------
---------------------------------|
|
|
|       To:       How to use Revolution
<use-revolution at lists.runrev.com>                                |
|       cc:
|
|       Subject:  Re: testing on case
|

>-----------------------------------------------------------------------
---------------------------------|





On Dec 9, 2004, at 11:46 AM, Hershel Fisch wrote:

>> if matchText( param(x), "^[A-Z]") then put xxx else put x
> I don't get it

The expression matchText( z, "^[A-Z]") will return true if (and only
when) the first character is an ASCII capital letter.  The "^" matches
the beginning of the string (or line).  A more exact pattern is "\A"; I
used "^" because it might be more familiar.  The immediately following
pattern [A-Z] matches any letter in the range A-Z in ASCII.  It must
match right after the previous pattern match, that is, the beginning.
There is no pattern matching for the end of the string so the rest of
the string z does not matter.  That is, matchText() returns true if the
pattern occurs anywhere in the string, not just if it matches the whole
string.  (Use \A and \z to match the ends to make a pattern match the
whole string.)

You can find more info on regular expressions here:

http://www.perldoc.com/perl5.8.0/pod/perlre.html

But you have to skip over all the perl specific parts.

You can find more specific information on exact usage of the actual
library used in Revolution and (I assume) Dreamcard here:

http://www.pcre.org/pcre.txt

But you have to skip over all the building and calling parts.  Skip
down to PCRE REGULAR EXPRESSION DETAILS.  I think you need to skip over
the unicode and UTF-8 paragraphs, too, for now.

Dar

****************************************
Dar Scott Consulting
http://www.swcp.com/dsc/
Programming Services
****************************************

_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution
_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


More information about the use-livecode mailing list