View source code
							
							
						
								Display the source code in std/regex.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.
							
						std.regex.Regex/regex  - multiple declarations
				Function regex
Compile regular expression pattern for the later execution.
						
				auto auto regex(S)
				(
				
				  S[] patterns,
				
				  const(char)[] flags = ""
				
				) @trusted
				
				if (isSomeString!S);
				
				
				auto auto regex(S)
				(
				
				  S pattern,
				
				  const(char)[] flags = ""
				
				) @trusted
				
				if (isSomeString!S);
						
					
				Returns
Regex object that works on inputs having
    the same character width as pattern.
Parameters
| Name | Description | 
|---|---|
| pattern | A single regular expression to match. | 
| patterns | An array of regular expression strings.
        The resulting Regexobject will match any expression;
        usewhichPatternto know which. | 
| flags | The attributes (g, i, m, s and x accepted) | 
Throws
RegexException if there were any errors during compilation.
Example
// multi-pattern regex example
auto multi = regex([`([a-z]+):(\d+)`, `(\d+),\d+`]); // multi regex
auto m = "abc:43 12,34"Alias Regex
Regex object holds regular expression pattern in compiled form.
						
				alias Regex(Char)
				 = std
				Instances of this object are constructed via calls to regex.
    This is an intended form for caching and storage of frequently
    used regular expressions.
Example
Test if this object doesn't contain any compiled pattern.
Regex!char r;
assert(rGetting a range of all the named captures in the regex.
import stdAuthors
Dmitry Olshansky,
    API and utility constructs are modeled after the original std
  by Walter Bright and Andrei Alexandrescu.
License
					Copyright © 1999-2022 by the D Language Foundation | Page generated by ddox.