View source code
Display the source code in std/uuid.d from which this
page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a
Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Enum member std.uuid.uuidRegex
Regex string to extract UUIDs from text.
enum uuidRegex
= "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}";
Example
import std .algorithm;
import std .regex;
string test = "Lorem ipsum dolor sit amet, consetetur "~
"6ba7b814-9dad-11d1-80b4-00c04fd430c8 sadipscing \n"~
"elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore \r\n"~
"magna aliquyam erat, sed diam voluptua. "~
"8ab3060e-2cba-4f23-b74c-b52db3bdfb46 At vero eos et accusam et "~
"justo duo dolores et ea rebum.";
auto r = regex(uuidRegex, "g");
UUID[] found;
foreach (c; match(test, r))
{
found ~= UUID(c .hit);
}
assert(found == [
UUID("6ba7b814-9dad-11d1-80b4-00c04fd430c8"),
UUID("8ab3060e-2cba-4f23-b74c-b52db3bdfb46"),
]);
Authors
Johannes Pfau
License
Copyright © 1999-2024 by the D Language Foundation | Page generated by ddox.