Originally Posted by DarkT
Code:
string.find(arg1, arg2, 1, true)
The 3rd argument specifies where to start the search (1 is default), and the 4th specifies whether or not pattern matching facilities should be turned off (false is default), so setting it to true will just do a regular plain "find substring" operation.
|
What would happen if you wanted to do pattern matching but needed to use that character?
Vraxi: You need to escape the . characters. You can do this with a % sign. What you would want, for your above expression:
string.find("DoH!?!","DoH%.%.%.")
And as you see:
Code:
> a = "DoH!?!";
> return string.find(a, "DoH...");
1 6
> return string.find(a, "DoH%.%.%.");
nil
> a = "DoH...";
> return string.find(a, "DoH%.%.%.");
1 6
(Btw, string.find returns nil, not false, when it doesn't match. Slight but important difference)
Good luck
-- Shirik