match a parenthesis literal in a lived regex?

Kay C Lan lan.kc.macmail at gmail.com
Wed Jan 27 03:22:17 CET 2016


typo

 --in all cases '(' should end up in the msg box

I originally tested:

 if (matchText(tStore,"(\(\w+)",tFound) = true) then

so it was finding: (text

but your request was for a single opening parenthesis so I removed the \w+
bit

On Wed, Jan 27, 2016 at 10:18 AM, Kay C Lan <lan.kc.macmail at gmail.com>
wrote:

> You're missing something :-) If you are using the matchText function you
> must remember you still need your capturing parenthesis
>
> \( will find a single opening parenthesis
> [(] will find a single opening parenthesis
> [\(] will find a single opening parenthesis or back slash
>
> in the msg box - change the commented line to test each:
>
>    put "here is some (text in brackets) and some not." into tStore
>    if (matchText(tStore,"(\()",tFound) = true) then
>    --if (matchText(tStore,"([(])",tFound) = true) then
>    --if (matchText(tStore,"([\(])",tFound) = true) then
>       put tFound into msg
>       --in all cases '(text' should end up in the msg box
>    else
>       put "Not Found" into msg
>    end if
>
> LC uses PCRE regex which can be tested here:
>
> https://regex101.com/#pcre
>
> Make sure PCRE is checked in the left hand column. If it works here it
> will work in LC - but you still must remember to add the quotes and if you
> are looking for more than a simple true or false, then you'll need to add
> the capturing parenthesis - but this too can be tested at the above site,
> the matches will appear in the second window down in the right hand column.
>
> On Wed, Jan 27, 2016 at 6:10 AM, Dr. Hawkins <dochawk at gmail.com> wrote:
>
>> My understanding is that at least one of [(] or [\(] should match an
>> opening parenthesis in a regular expression, but my experimenting isn't
>> filing this.
>>
>> Am I missing something, or is this just not implemented?
>>
>> --
>> Dr. Richard E. Hawkins, Esq.
>> (702) 508-8462
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
>


More information about the use-livecode mailing list