testing on case

Lynch, Jonathan BNZ2 at CDC.GOV
Thu Dec 9 16:02:49 EST 2004


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


More information about the use-livecode mailing list