find Regular Expression function in LC editor and/or IDE

Douglas Ruisaard dougr at telus.net
Wed Aug 8 16:15:38 EDT 2018


using LC Business v8.1.9 on Windows 7 Pro and/or LC Business v9.0 on Mac 10.12.6

in the Message Box, put:
put "                  put x into y" into x; put matchText(x,"^\s(put)?((?!into).)*$")
produces "false"

in the Message Box, put:
put "                put x" into x; put matchText(x,"^\s(put)?((?!into).)*$")
produces "true"

BOTH results are correct.

Now try to use that same pattern match (without the quotes) within the FIND => "More" of the Script Editor (with the script of a scripted object being viewed as the current tab) with the "Find options" set to "Regular Expression" and "Look in" set to "Current Tab"
produces "Total results found: 0" when, I would have anticipated, it should have found ALL lines WITH "put" but WTHOUT the phrase "into" (assuming there are some)... you can remove the "put" component of the RegEx and it still won't find anything.

Same result when using the FIND utility of the IDE, after checking the "Reg Expression", selecting an object with some script (using the Project Browser), setting the "In" to "The current selection"
produces "0 objects found

I am trying to use either FIND utility to display the script lines which simply "put" stuff to the Message Box (i.e. lines with no "put {...} into {...}" (or "after" or "before"... but starting with "into")) which I use extensively in debugging scripts.

Wrong RegEx? Bug?

Yes, I could write a script to read all scripts and then use "matchText" (as above).. but why won't the FIND utilities do this for me?

Also of note... using RegEx in the Script Editor FIND => More... can EASILY lock up LC ... e.g. enter:

^\s?((?into).)* into "Find what:" (which "matchText" returns as "true" for any string) This locks up LC when used in the Script Editor's FIND function .. and be ready to have to kill the "livecode" process... at least under Windows 7.

Douglas Ruisaard
Trilogy Software
(250) 573-3935







More information about the use-livecode mailing list