search

Search s[] for first match with pattern[] with attributes[].

search
(
string s
,
string pattern
,
string attributes = null
)

Parameters

s string

String to search.

pattern string

Regular expression pattern.

attributes string

Regular expression attributes.

Return Value

Type: RegExp

corresponding RegExp if found, null if not.

Examples

import std.stdio;
import undead.regexp;

void main()
{
    if (auto m = undead.regexp.search("abcdef", "c"))
    {
        writefln("%s[%s]%s", m.pre, m[0], m.post);
    }
}
// Prints:
// ab[c]def

Meta