View Issue Details

IDProjectCategoryView StatusLast Update
0000185LDMudEfunspublic2004-11-26 22:25
ReporterlarsAssigned To 
Status newResolutionopen 
Summary0000185: New efun: strmatch()
DescriptionShort: New efun strmatch()
From: Matthew Julius <>
Date: Fri, 08 Jan 1999 16:29:08 -0500
Type: Feature
State: Unclassified

string|string* strmatch(string|string*, string*|string)
  Return string matching pattern, strings matching pattern, or patterns
  matching string. The patterns are not regexp's, but patterns consisting
  of '*' and '?', such as user input. This isn't easy to do with regexp()
  since the patterns need to have sensitive characters escaped, which is
  costly in LPC. For examples,
    strmatch("london", "lon*") returns "london"
    strmatch(({ "london", "little", "like" }), "li*e")
     returns ({ "little", "like" })
    strmatch("file.o", ({ "*.o", "*.c", "*.h", "*.?", "*" }))
     returns ({ "*.o", "*.?", "*" })
  The Timewarp mudlib names this match_wildcard(), but as a sefun.

alfebtcd wrote:

> // this is useful to quote any string to be interpreted literally by the
> // regexp functions
> #define QUOTE_FOR_REGEXP(str) \
> regreplace(str,"([()[\\].*^$|\\\\])","\\\\\\1",1)
> // this does the same for single characters appearing between [ and ]
> #define QUOTE_CHARS_FOR_REGEXP(str) \
> regreplace(regreplace(str,"\\]","\\]",1),"([^-])-(..*)","\\1\\2-",1)

Again, see above. I suppose it's time to recompile our GD.
TagsNo tags attached.
External Data (URL)


There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2004-11-26 22:25 lars New Issue