int find(rchar[] string, char[] pattern, char[] attributes = null)
|
Search string for the first match with pattern with attributes. Returns the index in string of the match if found, -1 if no match.
Example:
import std.stdio;
import std.regexp;
int main() {
char[] str = "Regular expressions can be fun!";
int index = find(str,"[a-z]*n[a-z]*","i"); writefln("Index: %d",index);
index = find(str,"-?[0-9]+");
if(index == -1) {
writefln("No integers found.");
}
return 0;
}
|
Output:
Index: 8
No integers found. |
|