RegexAndStuffLib Script Library

Something else I missed in the SD documentation. That will certainly help when I’m working with new commands. So little time, so much to learn.

This seems odd. When I run this RegexAndStuffLib script

use script "RegexAndStuffLib" version "1.0.7"

set string1 to "SPORTS: MLB Baseball"
set string2 to "Sports: NFL Football"

set thePrefix to 
      common prefix of string1 ¬
         with string2 without match case

I get this error and partial result:

	set theString to NSString's stringWithString:origString
return (theString's commonPrefixWithString:otherString options:((not matchCase) as integer)) as text

When compiled it looks like it’s trying to treat string2 as a boolean because of the “with” reference. Or am I missing something?

→ Script Debugger 8.0.4 (8A50)
→ Mac OS 11.6.3 (20G415)

That’s right. The parameter name is with string, so:

set thePrefix to  common prefix of string1 with string string2 without match case