Matchtext - looking for chars in each line of a list of word

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: heatherlaine, Klaus, FourthWorld, kevinmiller

Post Reply
SethMould
Posts: 6
Joined: Tue Oct 06, 2015 3:02 pm

Matchtext - looking for chars in each line of a list of word

Post by SethMould » Thu Oct 22, 2015 4:45 pm

repeat for each line temp in tAnswers
put 0 into nCount
if matchtext(temp,"*" & char 1 of tGuess & "*") then
add 1 to nCount
end if

I get an Error in the third statement

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6044
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Matchtext - looking for chars in each line of a list of

Post by FourthWorld » Thu Oct 22, 2015 7:04 pm

SethMould wrote:I get an Error in the third statement
What does the error say?
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5425
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Matchtext - looking for chars in each line of a list of

Post by dunbarx » Thu Oct 22, 2015 7:56 pm

The problem is runtime, and in the matchText line.

Does this make sense:

Code: Select all

if matchtext(temp, char 1 of tGuess & "*") then
Craig Newman

elanorb
Livecode Staff Member
Livecode Staff Member
Posts: 249
Joined: Fri Feb 24, 2006 9:45 am

Re: Matchtext - looking for chars in each line of a list of

Post by elanorb » Thu Oct 29, 2015 5:17 pm

Hi Seth

I think you need to specify what the * is allowed to match, so something like

Code: Select all

put matchtext(temp,"[a-zA-Z]*" & char 1 of tGuess & "[a-zA-Z]*")
This resource, which Charles Buchwald pointed to in the Dictionary comments, is really useful

http://www.regextester.com/index.html

I hope that helps.

Kind regards

Elanor
Elanor Buchanan
Software Developer
LiveCode

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”