View/Edit #7480:strsearch

Switch to edit mode.

Name(s): strsearch
1:  "This is a very interesting verb concept. Given a string (possibly something heard in a room), try to match it against a regular expression, however, create the regular expression, and then match one of the matches in the regexp loosely within a set of strings. Boggle!"
2:  {string, regexp, names} = args
3:  if (index(regexp, "%-") > index(regexp, "%("))
4:    search = 2
5:  else
6:    search = 1
7:  endif
8:  regexp = strsub(regexp, "%-%-%", "%([A-Za-z0-9]+%)")
9:  "#8084:tell(\"strsearch: regexp=\", toliteral(regexp), \"  string=\", toliteral(string), \"  match()=\", toliteral(match(string, regexp)));"
10: if (!(data = match(string, regexp)))
11:   return 0
12: endif
13: name = `string[data[3][search][1]..data[3][search][2]] ! E_RANGE'
14: "#8084:Tell(name);"
15: if (name == E_RANGE)
16:   return 0
17: endif
18: if (name == "you")
19:   return data
20: endif
21: for x in (names)
22:   if ($su:textmatch(name, x) >= 0.8)
23:     return data
24:   endif
25: endfor
26: return
27: "Last modified by Lao-Tzu (#8084) on Wed Aug 18 14:24:55 1999 MDT."

Verb arguments: this none this
Verb perms: Readable eXecutable NOT-Debug
Verb owned by: michele (#9878)

You are not logged in.

[home | help | who | search | setup | code]