Regex 将正则表达式结果保存到变量

Regex 将正则表达式结果保存到变量,regex,applescript,Regex,Applescript,我在applescript和Satimage osax中使用正则表达式。它工作正常,但我希望能够将返回的匹配项保存到一个变量中以供使用 这是我在applescript编辑器的回复部分看到的内容: find text "(?i)(nhl|nfl|ncaa)" in "NFL games.pdf" with regexp --> {matchPos:0, matchLen:3, matchResult:"NFL"} 我可以使用一个对话框来显示结果,但无论我怎么做,都无法将其保存到变量

我在applescript和Satimage osax中使用正则表达式。它工作正常,但我希望能够将返回的匹配项保存到一个变量中以供使用

这是我在applescript编辑器的回复部分看到的内容:

find text "(?i)(nhl|nfl|ncaa)" in "NFL games.pdf" with regexp
    --> {matchPos:0, matchLen:3, matchResult:"NFL"}
我可以使用一个对话框来显示结果,但无论我怎么做,都无法将其保存到变量中

作品:

display dialog matchResult of (find text "(?i)(nhl|nfl|ncaa)" in theName with 
regexp)
不起作用:

set matchResult of (find text "(?i)(nhl|nfl|ncaa)" in theName with regexp) to 
keywordResult
set (matchResult of (find text "(?i)(nhl|nfl|ncaa)" in theName with regexp)) to 
keywordResult
任何帮助都将不胜感激

瑞安

你也可以:

set keywordResult to (find text "(?i)(nhl|nfl|ncaa)" in "NFL games.pdf" with regexp)
matchResult of keywordResult --> "NFL"
matchLen of keywordResult --> 3
matchPos of keywordResult --> 0

下面这个例子正是我想要的。我一定是盯着那一行看得太久了。谢谢你的帮助。
copy matchResult of (find text "(?i)(nhl|nfl|ncaa)" in theName with regexp) to keywordResult
set keywordResult to (find text "(?i)(nhl|nfl|ncaa)" in "NFL games.pdf" with regexp)
matchResult of keywordResult --> "NFL"
matchLen of keywordResult --> 3
matchPos of keywordResult --> 0