View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000185 | LDMud | Efuns | public | 2004-11-26 21:25 | 2004-11-26 21:25 |
Reporter | Assigned To | ||||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | new | Resolution | open | ||
Summary | 0000185: New efun: strmatch() | ||||
Description | Short: New efun strmatch() From: Matthew Julius <julius.2@wright.edu> 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. | ||||
Tags | No tags attached. | ||||
External Data (URL) | |||||