The OpenD Programming Language

unicode.parseSet

Parse unicode codepoint set from given range using standard regex syntax '...'. The range is advanced skiping over regex set definition. casefold parameter determines if the set should be casefolded - that is include both lower and upper case versions for any letters in the set.

struct unicode
static
parseSet
(
Range
)
(
ref Range range
,
bool casefold = false
)
if (
isInputRange!Range &&
is(ElementType!Range : dchar)
)

Examples

import std.uni : unicode;
string pat = "[a-zA-Z0-9]hello";
auto set = unicode.parseSet(pat);
// check some of the codepoints
assert(set['a'] && set['A'] && set['9']);
assert(pat == "hello");

Meta