Text comparison no working
Text comparison no working
- Subject: Text comparison no working
- From: Jim Brandt via AppleScript-Users <email@hidden>
- Date: Fri, 17 Sep 2021 16:06:01 -0500
I've got a peice of code that I've pulled from a handler that ins't working the
way I expected it to.
Here's the code:
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
set IntroNames to {"Forward", "Foreward", "Prologue", "Introduction"}
set LinkText to "<span class=\"link\"><a
href=\"Mybook/chapters/linktoforward\">Foreword</a></span>"
set NameStr to "(<span class=\"link\".*?\">)(.*?)(</a></span>)"
set LinkName to change NameStr into "\\2" in LinkText with regexp
--set LinkName to "Foreward"
set TheClass to class of LinkName
set NameLength to length of LinkName
set AddSpace to IntroNames contains LinkName
When I run this code, the variable "LinkName" contains the text "Foreward"
When the last line executes, the result is false, which is NOT what I expected.
When I uncomment --set LinkName to "Foreward” line, and run the code, the
result of the last line is true, which is what I expected it to be.
I added the class and length lines just to verify that the variable LinkName
was coming out as expected, a text variable of length 8 characters.
BTW, the "change" command is part of the Satimage OSAX which I use quite a bit.
Anybody have a clue as to what I'm not doing correctly here?
Jim Brandt
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden