View source code
					
 Display the source code in std/uuid.d from which this page was generated on
 github.
					
				
				
 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.
					
				
				
 Page wiki
					
 View or edit the community-maintained wiki page associated with this page.
					
				
			
			Enum std.uuid.member uuidRegex
			Regex string to extract UUIDs from text.
Declaration
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