From 64106c4d3d4ddba8c7bc2af75376e6d3d3d75601 Mon Sep 17 00:00:00 2001 From: Date: Mon, 29 Jun 2015 20:16:15 +0000 Subject: Update documentation --- regex/char/index.html | 0 regex/char/sidebar-items.js | 1 + regex/char/struct.Char.html | 0 regex/enum.Error.html | 115 +++++++ regex/enum.Regex.html | 401 +++++++++++++++++++++++ regex/fn.is_match.html | 108 +++++++ regex/fn.quote.html | 105 ++++++ regex/index.html | 588 ++++++++++++++++++++++++++++++++++ regex/input/index.html | 0 regex/input/sidebar-items.js | 1 + regex/input/struct.CharInput.html | 0 regex/input/struct.InputAt.html | 0 regex/input/trait.Input.html | 0 regex/program/enum.Inst.html | 0 regex/program/enum.LookInst.html | 0 regex/program/index.html | 0 regex/program/sidebar-items.js | 1 + regex/program/struct.CharRanges.html | 0 regex/program/struct.OneChar.html | 0 regex/program/struct.Program.html | 0 regex/re/enum.Error.html | 10 + regex/re/enum.Regex.html | 10 + regex/re/fn.is_match.html | 10 + regex/re/fn.quote.html | 10 + regex/re/index.html | 0 regex/re/sidebar-items.js | 1 + regex/re/struct.Captures.html | 10 + regex/re/struct.FindCaptures.html | 10 + regex/re/struct.FindMatches.html | 10 + regex/re/struct.NoExpand.html | 10 + regex/re/struct.RegexSplits.html | 10 + regex/re/struct.RegexSplitsN.html | 10 + regex/re/struct.SubCaptures.html | 10 + regex/re/struct.SubCapturesNamed.html | 10 + regex/re/struct.SubCapturesPos.html | 10 + regex/re/trait.Replacer.html | 10 + regex/sidebar-items.js | 1 + regex/struct.Captures.html | 156 +++++++++ regex/struct.FindCaptures.html | 152 +++++++++ regex/struct.FindMatches.html | 153 +++++++++ regex/struct.NoExpand.html | 110 +++++++ regex/struct.RegexSplits.html | 149 +++++++++ regex/struct.RegexSplitsN.html | 151 +++++++++ regex/struct.SubCaptures.html | 149 +++++++++ regex/struct.SubCapturesNamed.html | 149 +++++++++ regex/struct.SubCapturesPos.html | 151 +++++++++ regex/trait.Replacer.html | 125 ++++++++ 47 files changed, 2907 insertions(+) create mode 100644 regex/char/index.html create mode 100644 regex/char/sidebar-items.js create mode 100644 regex/char/struct.Char.html create mode 100644 regex/enum.Error.html create mode 100644 regex/enum.Regex.html create mode 100644 regex/fn.is_match.html create mode 100644 regex/fn.quote.html create mode 100644 regex/index.html create mode 100644 regex/input/index.html create mode 100644 regex/input/sidebar-items.js create mode 100644 regex/input/struct.CharInput.html create mode 100644 regex/input/struct.InputAt.html create mode 100644 regex/input/trait.Input.html create mode 100644 regex/program/enum.Inst.html create mode 100644 regex/program/enum.LookInst.html create mode 100644 regex/program/index.html create mode 100644 regex/program/sidebar-items.js create mode 100644 regex/program/struct.CharRanges.html create mode 100644 regex/program/struct.OneChar.html create mode 100644 regex/program/struct.Program.html create mode 100644 regex/re/enum.Error.html create mode 100644 regex/re/enum.Regex.html create mode 100644 regex/re/fn.is_match.html create mode 100644 regex/re/fn.quote.html create mode 100644 regex/re/index.html create mode 100644 regex/re/sidebar-items.js create mode 100644 regex/re/struct.Captures.html create mode 100644 regex/re/struct.FindCaptures.html create mode 100644 regex/re/struct.FindMatches.html create mode 100644 regex/re/struct.NoExpand.html create mode 100644 regex/re/struct.RegexSplits.html create mode 100644 regex/re/struct.RegexSplitsN.html create mode 100644 regex/re/struct.SubCaptures.html create mode 100644 regex/re/struct.SubCapturesNamed.html create mode 100644 regex/re/struct.SubCapturesPos.html create mode 100644 regex/re/trait.Replacer.html create mode 100644 regex/sidebar-items.js create mode 100644 regex/struct.Captures.html create mode 100644 regex/struct.FindCaptures.html create mode 100644 regex/struct.FindMatches.html create mode 100644 regex/struct.NoExpand.html create mode 100644 regex/struct.RegexSplits.html create mode 100644 regex/struct.RegexSplitsN.html create mode 100644 regex/struct.SubCaptures.html create mode 100644 regex/struct.SubCapturesNamed.html create mode 100644 regex/struct.SubCapturesPos.html create mode 100644 regex/trait.Replacer.html (limited to 'regex') diff --git a/regex/char/index.html b/regex/char/index.html new file mode 100644 index 0000000..e69de29 diff --git a/regex/char/sidebar-items.js b/regex/char/sidebar-items.js new file mode 100644 index 0000000..caf0381 --- /dev/null +++ b/regex/char/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"struct":[["Char","An inline representation of `Option`."]]}); \ No newline at end of file diff --git a/regex/char/struct.Char.html b/regex/char/struct.Char.html new file mode 100644 index 0000000..e69de29 diff --git a/regex/enum.Error.html b/regex/enum.Error.html new file mode 100644 index 0000000..bee1961 --- /dev/null +++ b/regex/enum.Error.html @@ -0,0 +1,115 @@ + + + + + + + + + + regex::Error - Rust + + + + + + + + + + + + + + + +
+

Enum regex::Error + + [] + + [src]

+
pub enum Error {
+    Syntax(Error),
+    CompiledTooBig(usize),
+    // some variants omitted
+}

An error that occurred during parsing or compiling a regular expression.

+

Variants

+
Syntax

A syntax error.

+
CompiledTooBig

The compiled program exceeded the set size limit. +The argument is the size limit imposed.

+

Trait Implementations

impl Error for Error

fn description(&self) -> &str

+

fn cause(&self) -> Option<&Error>

+

impl Display for Error

fn fmt(&self, f: &mut Formatter) -> Result

+

impl From<Error> for Error

fn from(err: Error) -> Error

+

Derived Implementations

impl Debug for Error

fn fmt(&self, __arg_0: &mut Formatter) -> Result

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/regex/enum.Regex.html b/regex/enum.Regex.html new file mode 100644 index 0000000..ba1e058 --- /dev/null +++ b/regex/enum.Regex.html @@ -0,0 +1,401 @@ + + + + + + + + + + regex::Regex - Rust + + + + + + + + + + + + + + + +
+

Enum regex::Regex + + [] + + [src]

+
pub enum Regex {
+    // some variants omitted
+}

A compiled regular expression

+ +

It is represented as either a sequence of bytecode instructions (dynamic) +or as a specialized Rust function (native). It can be used to search, split +or replace text. All searching is done with an implicit .*? at the +beginning and end of an expression. To force an expression to match the +whole string (or a prefix or a suffix), you must use an anchor like ^ or +$ (or \A and \z).

+ +

While this crate will handle Unicode strings (whether in the regular +expression or in the search text), all positions returned are byte +indices. Every byte index is guaranteed to be at a Unicode code point +boundary.

+ +

The lifetimes 'r and 't in this crate correspond to the lifetime of a +compiled regular expression and text to search, respectively.

+ +

The only methods that allocate new strings are the string replacement +methods. All other methods (searching and splitting) return borrowed +pointers into the string given.

+ +

Examples

+

Find the location of a US phone number:

+
+let re = Regex::new("[0-9]{3}-[0-9]{3}-[0-9]{4}").unwrap();
+assert_eq!(re.find("phone: 111-222-3333"), Some((7, 19)));
+
+ +

Using the std::str::StrExt methods with Regex

+
+

Note: This section requires that this crate is currently compiled with + the pattern Cargo feature enabled.

+
+ +

Since Regex implements Pattern, you can use regexes with methods +defined on std::str::StrExt. For example, is_match, find, find_iter +and split can be replaced with StrExt::contains, StrExt::find, +StrExt::match_indices and StrExt::split.

+ +

Here are some examples:

+
+let re = Regex::new(r"\d+").unwrap();
+let haystack = "a111b222c";
+
+assert!(haystack.contains(&re));
+assert_eq!(haystack.find(&re), Some(1));
+assert_eq!(haystack.match_indices(&re).collect::<Vec<_>>(),
+           vec![(1, 4), (5, 8)]);
+assert_eq!(haystack.split(&re).collect::<Vec<_>>(), vec!["a", "b", "c"]);
+
+

Methods

impl Regex

fn new(re: &str) -> Result<Regex, Error>

+

Compiles a dynamic regular expression. Once compiled, it can be +used repeatedly to search, split or replace text in a string.

+ +

If an invalid expression is given, then an error is returned.

+

fn with_size_limit(size: usize, re: &str) -> Result<Regex, Error>

+

Compiles a dynamic regular expression with the given size limit.

+ +

The size limit is applied to the size of the compiled data structure. +If the data structure exceeds the size given, then an error is +returned.

+ +

The default size limit used in new is 10MB.

+

fn is_match(&self, text: &str) -> bool

+

Returns true if and only if the regex matches the string given.

+ +

Example

+

Test if some text contains at least one word with exactly 13 +characters:

+
+let text = "I categorically deny having triskaidekaphobia.";
+assert!(Regex::new(r"\b\w{13}\b").unwrap().is_match(text));
+
+

fn find(&self, text: &str) -> Option<(usize, usize)>

+

Returns the start and end byte range of the leftmost-first match in +text. If no match exists, then None is returned.

+ +

Note that this should only be used if you want to discover the position +of the match. Testing the existence of a match is faster if you use +is_match.

+ +

Example

+

Find the start and end location of the first word with exactly 13 +characters:

+
+let text = "I categorically deny having triskaidekaphobia.";
+let pos = Regex::new(r"\b\w{13}\b").unwrap().find(text);
+assert_eq!(pos, Some((2, 15)));
+
+

fn find_iter<'r, 't>(&'r self, text: &'t str) -> FindMatches<'r, 't>

+

Returns an iterator for each successive non-overlapping match in +text, returning the start and end byte indices with respect to +text.

+ +

Example

+

Find the start and end location of every word with exactly 13 +characters:

+
+let text = "Retroactively relinquishing remunerations is reprehensible.";
+for pos in Regex::new(r"\b\w{13}\b").unwrap().find_iter(text) {
+    println!("{:?}", pos);
+}
+// Output:
+// (0, 13)
+// (14, 27)
+// (28, 41)
+// (45, 58)
+
+

fn captures<'t>(&self, text: &'t str) -> Option<Captures<'t>>

+

Returns the capture groups corresponding to the leftmost-first +match in text. Capture group 0 always corresponds to the entire +match. If no match is found, then None is returned.

+ +

You should only use captures if you need access to submatches. +Otherwise, find is faster for discovering the location of the overall +match.

+ +

Examples

+

Say you have some text with movie names and their release years, +like "'Citizen Kane' (1941)". It'd be nice if we could search for text +looking like that, while also extracting the movie name and its release +year separately.

+
+let re = Regex::new(r"'([^']+)'\s+\((\d{4})\)").unwrap();
+let text = "Not my favorite movie: 'Citizen Kane' (1941).";
+let caps = re.captures(text).unwrap();
+assert_eq!(caps.at(1), Some("Citizen Kane"));
+assert_eq!(caps.at(2), Some("1941"));
+assert_eq!(caps.at(0), Some("'Citizen Kane' (1941)"));
+
+ +

Note that the full match is at capture group 0. Each subsequent +capture group is indexed by the order of its opening (.

+ +

We can make this example a bit clearer by using named capture groups:

+
+let re = Regex::new(r"'(?P<title>[^']+)'\s+\((?P<year>\d{4})\)")
+               .unwrap();
+let text = "Not my favorite movie: 'Citizen Kane' (1941).";
+let caps = re.captures(text).unwrap();
+assert_eq!(caps.name("title"), Some("Citizen Kane"));
+assert_eq!(caps.name("year"), Some("1941"));
+assert_eq!(caps.at(0), Some("'Citizen Kane' (1941)"));
+
+ +

Here we name the capture groups, which we can access with the name +method. Note that the named capture groups are still accessible with +at.

+ +

The 0th capture group is always unnamed, so it must always be +accessed with at(0).

+

fn captures_iter<'r, 't>(&'r self, text: &'t str) -> FindCaptures<'r, 't>

+

Returns an iterator over all the non-overlapping capture groups matched +in text. This is operationally the same as find_iter (except it +yields information about submatches).

+ +

Example

+

We can use this to find all movie titles and their release years in +some text, where the movie is formatted like "'Title' (xxxx)":

+
+let re = Regex::new(r"'(?P<title>[^']+)'\s+\((?P<year>\d{4})\)")
+               .unwrap();
+let text = "'Citizen Kane' (1941), 'The Wizard of Oz' (1939), 'M' (1931).";
+for caps in re.captures_iter(text) {
+    println!("Movie: {:?}, Released: {:?}", caps.name("title"), caps.name("year"));
+}
+// Output:
+// Movie: Citizen Kane, Released: 1941
+// Movie: The Wizard of Oz, Released: 1939
+// Movie: M, Released: 1931
+
+

fn split<'r, 't>(&'r self, text: &'t str) -> RegexSplits<'r, 't>

+

Returns an iterator of substrings of text delimited by a match +of the regular expression. +Namely, each element of the iterator corresponds to text that isn't +matched by the regular expression.

+ +

This method will not copy the text given.

+ +

Example

+

To split a string delimited by arbitrary amounts of spaces or tabs:

+
+let re = Regex::new(r"[ \t]+").unwrap();
+let fields: Vec<&str> = re.split("a b \t  c\td    e").collect();
+assert_eq!(fields, vec!("a", "b", "c", "d", "e"));
+
+

fn splitn<'r, 't>(&'r self, text: &'t str, limit: usize) -> RegexSplitsN<'r, 't>

+

Returns an iterator of at most limit substrings of text delimited +by a match of the regular expression. (A limit of 0 will return no +substrings.) +Namely, each element of the iterator corresponds to text that isn't +matched by the regular expression. +The remainder of the string that is not split will be the last element +in the iterator.

+ +

This method will not copy the text given.

+ +

Example

+

Get the first two words in some text:

+
+let re = Regex::new(r"\W+").unwrap();
+let fields: Vec<&str> = re.splitn("Hey! How are you?", 3).collect();
+assert_eq!(fields, vec!("Hey", "How", "are you?"));
+
+

fn replace<R: Replacer>(&self, text: &str, rep: R) -> String

+

Replaces the leftmost-first match with the replacement provided. +The replacement can be a regular string (where $N and $name are +expanded to match capture groups) or a function that takes the matches' +Captures and returns the replaced string.

+ +

If no match is found, then a copy of the string is returned unchanged.

+ +

Examples

+

Note that this function is polymorphic with respect to the replacement. +In typical usage, this can just be a normal string:

+
+let re = Regex::new("[^01]+").unwrap();
+assert_eq!(re.replace("1078910", ""), "1010");
+
+ +

But anything satisfying the Replacer trait will work. For example, +a closure of type |&Captures| -> String provides direct access to the +captures corresponding to a match. This allows one to access +submatches easily:

+
+let re = Regex::new(r"([^,\s]+),\s+(\S+)").unwrap();
+let result = re.replace("Springsteen, Bruce", |caps: &Captures| {
+    format!("{} {}", caps.at(2).unwrap_or(""), caps.at(1).unwrap_or(""))
+});
+assert_eq!(result, "Bruce Springsteen");
+
+ +

But this is a bit cumbersome to use all the time. Instead, a simple +syntax is supported that expands $name into the corresponding capture +group. Here's the last example, but using this expansion technique +with named capture groups:

+
+let re = Regex::new(r"(?P<last>[^,\s]+),\s+(?P<first>\S+)").unwrap();
+let result = re.replace("Springsteen, Bruce", "$first $last");
+assert_eq!(result, "Bruce Springsteen");
+
+ +

Note that using $2 instead of $first or $1 instead of $last +would produce the same result. To write a literal $ use $$.

+ +

Finally, sometimes you just want to replace a literal string with no +submatch expansion. This can be done by wrapping a string with +NoExpand:

+
+use regex::NoExpand;
+
+let re = Regex::new(r"(?P<last>[^,\s]+),\s+(\S+)").unwrap();
+let result = re.replace("Springsteen, Bruce", NoExpand("$2 $last"));
+assert_eq!(result, "$2 $last");
+
+

fn replace_all<R: Replacer>(&self, text: &str, rep: R) -> String

+

Replaces all non-overlapping matches in text with the +replacement provided. This is the same as calling replacen with +limit set to 0.

+ +

See the documentation for replace for details on how to access +submatches in the replacement string.

+

fn replacen<R: Replacer>(&self, text: &str, limit: usize, rep: R) -> String

+

Replaces at most limit non-overlapping matches in text with the +replacement provided. If limit is 0, then all non-overlapping matches +are replaced.

+ +

See the documentation for replace for details on how to access +submatches in the replacement string.

+

fn as_str<'a>(&'a self) -> &'a str

+

Returns the original string of this regex.

+

Trait Implementations

impl Display for Regex

fn fmt(&self, f: &mut Formatter) -> Result

+

impl Debug for Regex

fn fmt(&self, f: &mut Formatter) -> Result

+

impl PartialEq for Regex

Equality comparison is based on the original string. It is possible that +different regular expressions have the same matching behavior, but are +still compared unequal. For example, \d+ and \d\d* match the same set +of strings, but are not considered equal.

+

fn eq(&self, other: &Regex) -> bool

+

fn ne(&self, other: &Rhs) -> bool

+

impl Eq for Regex

impl FromStr for Regex

type Err = Error

+

fn from_str(s: &str) -> Result<Regex, Error>

+

impl<'r, 't> Pattern<'t> for &'r Regex

type Searcher = RegexSearcher<'r, 't>

+

fn into_searcher(self, haystack: &'t str) -> RegexSearcher<'r, 't>

+

fn is_contained_in(self, haystack: &'a str) -> bool

+

fn is_prefix_of(self, haystack: &'a str) -> bool

+

fn is_suffix_of(self, haystack: &'a str) -> bool where Self::Searcher: ReverseSearcher<'a>

+

Derived Implementations

impl Clone for Regex

fn clone(&self) -> Regex

+

fn clone_from(&mut self, source: &Self)

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/regex/fn.is_match.html b/regex/fn.is_match.html new file mode 100644 index 0000000..4a5ef51 --- /dev/null +++ b/regex/fn.is_match.html @@ -0,0 +1,108 @@ + + + + + + + + + + regex::is_match - Rust + + + + + + + + + + + + + + + +
+

Function regex::is_match + + [] + + [src]

+
pub fn is_match(regex: &str, text: &str) -> Result<bool, Error>

Tests if the given regular expression matches somewhere in the text given.

+ +

If there was a problem compiling the regular expression, an error is +returned.

+ +

To find submatches, split or replace text, you'll need to compile an +expression first.

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/regex/fn.quote.html b/regex/fn.quote.html new file mode 100644 index 0000000..61a022f --- /dev/null +++ b/regex/fn.quote.html @@ -0,0 +1,105 @@ + + + + + + + + + + regex::quote - Rust + + + + + + + + + + + + + + + +
+

Function regex::quote + + [] + + [src]

+
pub fn quote(text: &str) -> String

Escapes all regular expression meta characters in text.

+ +

The string returned may be safely used as a literal in a regular +expression.

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/regex/index.html b/regex/index.html new file mode 100644 index 0000000..53cb9ea --- /dev/null +++ b/regex/index.html @@ -0,0 +1,588 @@ + + + + + + + + + + regex - Rust + + + + + + + + + + + + + + + +
+

Crate regex + + [] + + [src]

+

This crate provides a native implementation of regular expressions that is +heavily based on RE2 both in syntax and in implementation. Notably, +backreferences and arbitrary lookahead/lookbehind assertions are not +provided. In return, regular expression searching provided by this package +has excellent worst-case performance. The specific syntax supported is +documented further down.

+ +

This crate's documentation provides some simple examples, describes Unicode +support and exhaustively lists the supported syntax. For more specific +details on the API, please see the documentation for the Regex type.

+ +

Usage

+

This crate is on crates.io and can be +used by adding regex to your dependencies in your project's Cargo.toml.

+ +
[dependencies]
+regex = "0.1.8"
+
+ +

and this to your crate root:

+
+extern crate regex;
+
+ +

First example: find a date

+

General use of regular expressions in this package involves compiling an +expression and then using it to search, split or replace text. For example, +to confirm that some text resembles a date:

+
+use regex::Regex;
+let re = Regex::new(r"^\d{4}-\d{2}-\d{2}$").unwrap();
+assert!(re.is_match("2014-01-01"));
+
+ +

Notice the use of the ^ and $ anchors. In this crate, every expression +is executed with an implicit .*? at the beginning and end, which allows +it to match anywhere in the text. Anchors can be used to ensure that the +full text matches an expression.

+ +

This example also demonstrates the utility of +raw strings +in Rust, which +are just like regular strings except they are prefixed with an r and do +not process any escape sequences. For example, "\\d" is the same +expression as r"\d".

+ +

The regex! macro

+

Rust's compile-time meta-programming facilities provide a way to write a +regex! macro which compiles regular expressions when your program +compiles. Said differently, if you only use regex! to build regular +expressions in your program, then your program cannot compile with an +invalid regular expression. Moreover, the regex! macro compiles the +given expression to native Rust code, which ideally makes it faster. +Unfortunately (or fortunately), the dynamic implementation has had a lot +more optimization work put it into it currently, so it is faster than +the regex! macro in most cases.

+ +

To use the regex! macro, you must enable the plugin feature and import +the regex_macros crate as a syntax extension:

+
+#![feature(plugin)]
+#![plugin(regex_macros)]
+extern crate regex;
+
+fn main() {
+    let re = regex!(r"^\d{4}-\d{2}-\d{2}$");
+    assert!(re.is_match("2014-01-01"));
+}
+
+ +

There are a few things worth mentioning about using the regex! macro. +Firstly, the regex! macro only accepts string literals. +Secondly, the regex crate must be linked with the name regex since +the generated code depends on finding symbols in the regex crate.

+ +

One downside of using the regex! macro is that it can increase the +size of your program's binary since it generates specialized Rust code. +The extra size probably won't be significant for a small number of +expressions, but 100+ calls to regex! will probably result in a +noticeably bigger binary.

+ +

NOTE: This is implemented using a compiler plugin, which is not +available on the Rust 1.0 beta/stable channels. Therefore, you'll only +be able to use regex! on the nightlies.

+ +

Example: iterating over capture groups

+

This crate provides convenient iterators for matching an expression +repeatedly against a search string to find successive non-overlapping +matches. For example, to find all dates in a string and be able to access +them by their component pieces:

+
+let re = Regex::new(r"(\d{4})-(\d{2})-(\d{2})").unwrap();
+let text = "2012-03-14, 2013-01-01 and 2014-07-05";
+for cap in re.captures_iter(text) {
+    println!("Month: {} Day: {} Year: {}",
+             cap.at(2).unwrap_or(""), cap.at(3).unwrap_or(""),
+             cap.at(1).unwrap_or(""));
+}
+// Output:
+// Month: 03 Day: 14 Year: 2012
+// Month: 01 Day: 01 Year: 2013
+// Month: 07 Day: 05 Year: 2014
+
+ +

Notice that the year is in the capture group indexed at 1. This is +because the entire match is stored in the capture group at index 0.

+ +

Example: replacement with named capture groups

+

Building on the previous example, perhaps we'd like to rearrange the date +formats. This can be done with text replacement. But to make the code +clearer, we can name our capture groups and use those names as variables +in our replacement text:

+
+let re = Regex::new(r"(?P<y>\d{4})-(?P<m>\d{2})-(?P<d>\d{2})").unwrap();
+let before = "2012-03-14, 2013-01-01 and 2014-07-05";
+let after = re.replace_all(before, "$m/$d/$y");
+assert_eq!(after, "03/14/2012, 01/01/2013 and 07/05/2014");
+
+ +

The replace methods are actually polymorphic in the replacement, which +provides more flexibility than is seen here. (See the documentation for +Regex::replace for more details.)

+ +

Note that if your regex gets complicated, you can use the x flag to +enable insigificant whitespace mode, which also lets you write comments:

+
+let re = Regex::new(r"(?x)
+  (?P<y>\d{4}) # the year
+  -
+  (?P<m>\d{2}) # the month
+  -
+  (?P<d>\d{2}) # the day
+").unwrap();
+let before = "2012-03-14, 2013-01-01 and 2014-07-05";
+let after = re.replace_all(before, "$m/$d/$y");
+assert_eq!(after, "03/14/2012, 01/01/2013 and 07/05/2014");
+
+ +

Pay for what you use

+

With respect to searching text with a regular expression, there are three +questions that can be asked:

+ +
    +
  1. Does the text match this expression?
  2. +
  3. If so, where does it match?
  4. +
  5. Where are the submatches?
  6. +
+ +

Generally speaking, this crate could provide a function to answer only #3, +which would subsume #1 and #2 automatically. However, it can be +significantly more expensive to compute the location of submatches, so it's +best not to do it if you don't need to.

+ +

Therefore, only use what you need. For example, don't use find if you +only need to test if an expression matches a string. (Use is_match +instead.)

+ +

Unicode

+

This implementation executes regular expressions only on sequences of +Unicode scalar values while exposing match locations as byte indices into +the search string.

+ +

Currently, only simple case folding is supported. Namely, when matching +case-insensitively, the characters are first mapped using the +simple case folding +mapping.

+ +

Regular expressions themselves are also only interpreted as a sequence +of Unicode scalar values. This means you can use Unicode characters +directly in your expression:

+
+let re = Regex::new(r"(?i)Δ+").unwrap();
+assert_eq!(re.find("ΔδΔ"), Some((0, 6)));
+
+ +

Finally, Unicode general categories and scripts are available as character +classes. For example, you can match a sequence of numerals, Greek or +Cherokee letters:

+
+let re = Regex::new(r"[\pN\p{Greek}\p{Cherokee}]+").unwrap();
+assert_eq!(re.find("abcΔᎠβⅠᏴγδⅡxyz"), Some((3, 23)));
+
+ +

Syntax

+

The syntax supported in this crate is almost in an exact correspondence +with the syntax supported by RE2. It is documented below.

+ +

Note that the regular expression parser and abstract syntax are exposed in +a separate crate, +regex-syntax.

+ +

Matching one character

+
+.           any character except new line (includes new line with s flag)
+[xyz]       A character class matching either x, y or z.
+[^xyz]      A character class matching any character except x, y and z.
+[a-z]       A character class matching any character in range a-z.
+\d          digit (\p{Nd})
+\D          not digit
+[:alpha:]   ASCII character class ([A-Za-z])
+[:^alpha:]  Negated ASCII character class ([^A-Za-z])
+\pN         One-letter name Unicode character class
+\p{Greek}   Unicode character class (general category or script)
+\PN         Negated one-letter name Unicode character class
+\P{Greek}   negated Unicode character class (general category or script)
+
+ +

Any named character class may appear inside a bracketed [...] character +class. For example, [\p{Greek}\pN] matches any Greek or numeral +character.

+ +

Composites

+
+xy    concatenation (x followed by y)
+x|y   alternation (x or y, prefer x)
+
+ +

Repetitions

+
+x*        zero or more of x (greedy)
+x+        one or more of x (greedy)
+x?        zero or one of x (greedy)
+x*?       zero or more of x (ungreedy)
+x+?       one or more of x (ungreedy)
+x??       zero or one of x (ungreedy)
+x{n,m}    at least n x and at most m x (greedy)
+x{n,}     at least n x (greedy)
+x{n}      exactly n x
+x{n,m}?   at least n x and at most m x (ungreedy)
+x{n,}?    at least n x (ungreedy)
+x{n}?     exactly n x
+
+ +

Empty matches

+
+^     the beginning of text (or start-of-line with multi-line mode)
+$     the end of text (or end-of-line with multi-line mode)
+\A    only the beginning of text (even with multi-line mode enabled)
+\z    only the end of text (even with multi-line mode enabled)
+\b    a Unicode word boundary (\w on one side and \W, \A, or \z on other)
+\B    not a Unicode word boundary
+
+ +

Grouping and flags

+
+(exp)          numbered capture group (indexed by opening parenthesis)
+(?P<name>exp)  named (also numbered) capture group (allowed chars: [_0-9a-zA-Z])
+(?:exp)        non-capturing group
+(?flags)       set flags within current group
+(?flags:exp)   set flags for exp (non-capturing)
+
+ +

Flags are each a single character. For example, (?x) sets the flag x +and (?-x) clears the flag x. Multiple flags can be set or cleared at +the same time: (?xy) sets both the x and y flags and (?x-y) sets +the x flag and clears the y flag.

+ +

All flags are by default disabled. They are:

+ +
+i     case-insensitive
+m     multi-line mode: ^ and $ match begin/end of line
+s     allow . to match \n
+U     swap the meaning of x* and x*?
+x     ignore whitespace and allow line comments (starting with `#`)
+
+ +

Here's an example that matches case-insensitively for only part of the +expression:

+
+let re = Regex::new(r"(?i)a+(?-i)b+").unwrap();
+let cap = re.captures("AaAaAbbBBBb").unwrap();
+assert_eq!(cap.at(0), Some("AaAaAbb"));
+
+ +

Notice that the a+ matches either a or A, but the b+ only matches +b.

+ +

Escape sequences

+
+\*         literal *, works for any punctuation character: \.+*?()|[]{}^$
+\a         bell (\x07)
+\f         form feed (\x0C)
+\t         horizontal tab
+\n         new line
+\r         carriage return
+\v         vertical tab (\x0B)
+\123       octal character code (up to three digits)
+\x7F       hex character code (exactly two digits)
+\x{10FFFF} any hex character code corresponding to a Unicode code point
+
+ +

Perl character classes (Unicode friendly)

+

These classes are based on the definitions provided in +UTS#18:

+ +
+\d     digit (\p{Nd})
+\D     not digit
+\s     whitespace (\p{White_Space})
+\S     not whitespace
+\w     word character (\p{Alphabetic} + \p{M} + \d + \p{Pc} + \p{Join_Control})
+\W     not word character
+
+ +

ASCII character classes

+
+[:alnum:]    alphanumeric ([0-9A-Za-z])
+[:alpha:]    alphabetic ([A-Za-z])
+[:ascii:]    ASCII ([\x00-\x7F])
+[:blank:]    blank ([\t ])
+[:cntrl:]    control ([\x00-\x1F\x7F])
+[:digit:]    digits ([0-9])
+[:graph:]    graphical ([!-~])
+[:lower:]    lower case ([a-z])
+[:print:]    printable ([ -~])
+[:punct:]    punctuation ([!-/:-@[-`{-~])
+[:space:]    whitespace ([\t\n\v\f\r ])
+[:upper:]    upper case ([A-Z])
+[:word:]     word characters ([0-9A-Za-z_])
+[:xdigit:]   hex digit ([0-9A-Fa-f])
+
+ +

Untrusted input

+

This crate can handle both untrusted regular expressions and untrusted +search text.

+ +

Untrusted regular expressions are handled by capping the size of a compiled +regular expression. (See Regex::with_size_limit.) Without this, it would +be trivial for an attacker to exhaust your system's memory with expressions +like a{100}{100}{100}.

+ +

Untrusted search text is allowed because the matching engine(s) in this +crate have time complexity O(mn) (with m ~ regex and n ~ search text), which means there's no way to cause exponential blow-up like with +some other regular expression engines. (We pay for this by disallowing +features like arbitrary look-ahead and back-references.)

+

Structs

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Captures +

Captures represents a group of captured strings for a single match.

+ +
FindCaptures +

An iterator that yields all non-overlapping capture groups matching a +particular regular expression.

+ +
FindMatches +

An iterator over all non-overlapping matches for a particular string.

+ +
NoExpand +

NoExpand indicates literal string replacement.

+ +
RegexSplits +

Yields all substrings delimited by a regular expression match.

+ +
RegexSplitsN +

Yields at most N substrings delimited by a regular expression match.

+ +
SubCaptures +

An iterator over capture groups for a particular match of a regular +expression.

+ +
SubCapturesNamed +

An Iterator over named capture groups as a tuple with the group +name and the value.

+ +
SubCapturesPos +

An iterator over capture group positions for a particular match of a +regular expression.

+ +

Enums

+ + + + + + + + + + +
Error +

An error that occurred during parsing or compiling a regular expression.

+ +
Regex +

A compiled regular expression

+ +

Traits

+ + + + + +
Replacer +

Replacer describes types that can be used to replace matches in a string.

+ +

Functions

+ + + + + + + + + + +
is_match +

Tests if the given regular expression matches somewhere in the text given.

+ +
quote +

Escapes all regular expression meta characters in text.

+ +
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/regex/input/index.html b/regex/input/index.html new file mode 100644 index 0000000..e69de29 diff --git a/regex/input/sidebar-items.js b/regex/input/sidebar-items.js new file mode 100644 index 0000000..3640ad0 --- /dev/null +++ b/regex/input/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"struct":[["CharInput","An input reader over characters."],["InputAt","Represents a location in the input."]],"trait":[["Input","An abstraction over input used in the matching engines."]]}); \ No newline at end of file diff --git a/regex/input/struct.CharInput.html b/regex/input/struct.CharInput.html new file mode 100644 index 0000000..e69de29 diff --git a/regex/input/struct.InputAt.html b/regex/input/struct.InputAt.html new file mode 100644 index 0000000..e69de29 diff --git a/regex/input/trait.Input.html b/regex/input/trait.Input.html new file mode 100644 index 0000000..e69de29 diff --git a/regex/program/enum.Inst.html b/regex/program/enum.Inst.html new file mode 100644 index 0000000..e69de29 diff --git a/regex/program/enum.LookInst.html b/regex/program/enum.LookInst.html new file mode 100644 index 0000000..e69de29 diff --git a/regex/program/index.html b/regex/program/index.html new file mode 100644 index 0000000..e69de29 diff --git a/regex/program/sidebar-items.js b/regex/program/sidebar-items.js new file mode 100644 index 0000000..53aa678 --- /dev/null +++ b/regex/program/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"enum":[["Inst","An instruction, the underlying unit of a compiled regular expression"],["LookInst","The set of zero-width match instructions."]],"struct":[["CharRanges","A multi-range character class instruction."],["OneChar","A single character instruction."],["Program","Program represents a compiled regular expression. Once an expression is compiled, its representation is immutable and will never change. (Well, almost. In fact, the matching engines cache state that can be reused on subsequent searches. But this is interior mutability that shouldn't be observable by the caller.)"]]}); \ No newline at end of file diff --git a/regex/program/struct.CharRanges.html b/regex/program/struct.CharRanges.html new file mode 100644 index 0000000..e69de29 diff --git a/regex/program/struct.OneChar.html b/regex/program/struct.OneChar.html new file mode 100644 index 0000000..e69de29 diff --git a/regex/program/struct.Program.html b/regex/program/struct.Program.html new file mode 100644 index 0000000..e69de29 diff --git a/regex/re/enum.Error.html b/regex/re/enum.Error.html new file mode 100644 index 0000000..d5bba07 --- /dev/null +++ b/regex/re/enum.Error.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../regex/enum.Error.html...

+ + + \ No newline at end of file diff --git a/regex/re/enum.Regex.html b/regex/re/enum.Regex.html new file mode 100644 index 0000000..8d0d473 --- /dev/null +++ b/regex/re/enum.Regex.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../regex/enum.Regex.html...

+ + + \ No newline at end of file diff --git a/regex/re/fn.is_match.html b/regex/re/fn.is_match.html new file mode 100644 index 0000000..08e601b --- /dev/null +++ b/regex/re/fn.is_match.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../regex/fn.is_match.html...

+ + + \ No newline at end of file diff --git a/regex/re/fn.quote.html b/regex/re/fn.quote.html new file mode 100644 index 0000000..638c97a --- /dev/null +++ b/regex/re/fn.quote.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../regex/fn.quote.html...

+ + + \ No newline at end of file diff --git a/regex/re/index.html b/regex/re/index.html new file mode 100644 index 0000000..e69de29 diff --git a/regex/re/sidebar-items.js b/regex/re/sidebar-items.js new file mode 100644 index 0000000..b485ce7 --- /dev/null +++ b/regex/re/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"enum":[["Error","An error that occurred during parsing or compiling a regular expression."],["Regex","A compiled regular expression"]],"fn":[["is_match","Tests if the given regular expression matches somewhere in the text given."],["quote","Escapes all regular expression meta characters in `text`."]],"struct":[["Captures","Captures represents a group of captured strings for a single match."],["FindCaptures","An iterator that yields all non-overlapping capture groups matching a particular regular expression."],["FindMatches","An iterator over all non-overlapping matches for a particular string."],["NoExpand","NoExpand indicates literal string replacement."],["RegexSplits","Yields all substrings delimited by a regular expression match."],["RegexSplitsN","Yields at most `N` substrings delimited by a regular expression match."],["SubCaptures","An iterator over capture groups for a particular match of a regular expression."],["SubCapturesNamed","An Iterator over named capture groups as a tuple with the group name and the value."],["SubCapturesPos","An iterator over capture group positions for a particular match of a regular expression."]],"trait":[["Replacer","Replacer describes types that can be used to replace matches in a string."]]}); \ No newline at end of file diff --git a/regex/re/struct.Captures.html b/regex/re/struct.Captures.html new file mode 100644 index 0000000..9f065dc --- /dev/null +++ b/regex/re/struct.Captures.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../regex/struct.Captures.html...

+ + + \ No newline at end of file diff --git a/regex/re/struct.FindCaptures.html b/regex/re/struct.FindCaptures.html new file mode 100644 index 0000000..a223ce7 --- /dev/null +++ b/regex/re/struct.FindCaptures.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../regex/struct.FindCaptures.html...

+ + + \ No newline at end of file diff --git a/regex/re/struct.FindMatches.html b/regex/re/struct.FindMatches.html new file mode 100644 index 0000000..833c1bb --- /dev/null +++ b/regex/re/struct.FindMatches.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../regex/struct.FindMatches.html...

+ + + \ No newline at end of file diff --git a/regex/re/struct.NoExpand.html b/regex/re/struct.NoExpand.html new file mode 100644 index 0000000..d72348f --- /dev/null +++ b/regex/re/struct.NoExpand.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../regex/struct.NoExpand.html...

+ + + \ No newline at end of file diff --git a/regex/re/struct.RegexSplits.html b/regex/re/struct.RegexSplits.html new file mode 100644 index 0000000..a1aa0ae --- /dev/null +++ b/regex/re/struct.RegexSplits.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../regex/struct.RegexSplits.html...

+ + + \ No newline at end of file diff --git a/regex/re/struct.RegexSplitsN.html b/regex/re/struct.RegexSplitsN.html new file mode 100644 index 0000000..7ebc144 --- /dev/null +++ b/regex/re/struct.RegexSplitsN.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../regex/struct.RegexSplitsN.html...

+ + + \ No newline at end of file diff --git a/regex/re/struct.SubCaptures.html b/regex/re/struct.SubCaptures.html new file mode 100644 index 0000000..36d2394 --- /dev/null +++ b/regex/re/struct.SubCaptures.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../regex/struct.SubCaptures.html...

+ + + \ No newline at end of file diff --git a/regex/re/struct.SubCapturesNamed.html b/regex/re/struct.SubCapturesNamed.html new file mode 100644 index 0000000..07205e6 --- /dev/null +++ b/regex/re/struct.SubCapturesNamed.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../regex/struct.SubCapturesNamed.html...

+ + + \ No newline at end of file diff --git a/regex/re/struct.SubCapturesPos.html b/regex/re/struct.SubCapturesPos.html new file mode 100644 index 0000000..05dc859 --- /dev/null +++ b/regex/re/struct.SubCapturesPos.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../regex/struct.SubCapturesPos.html...

+ + + \ No newline at end of file diff --git a/regex/re/trait.Replacer.html b/regex/re/trait.Replacer.html new file mode 100644 index 0000000..80e186a --- /dev/null +++ b/regex/re/trait.Replacer.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../regex/trait.Replacer.html...

+ + + \ No newline at end of file diff --git a/regex/sidebar-items.js b/regex/sidebar-items.js new file mode 100644 index 0000000..b485ce7 --- /dev/null +++ b/regex/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"enum":[["Error","An error that occurred during parsing or compiling a regular expression."],["Regex","A compiled regular expression"]],"fn":[["is_match","Tests if the given regular expression matches somewhere in the text given."],["quote","Escapes all regular expression meta characters in `text`."]],"struct":[["Captures","Captures represents a group of captured strings for a single match."],["FindCaptures","An iterator that yields all non-overlapping capture groups matching a particular regular expression."],["FindMatches","An iterator over all non-overlapping matches for a particular string."],["NoExpand","NoExpand indicates literal string replacement."],["RegexSplits","Yields all substrings delimited by a regular expression match."],["RegexSplitsN","Yields at most `N` substrings delimited by a regular expression match."],["SubCaptures","An iterator over capture groups for a particular match of a regular expression."],["SubCapturesNamed","An Iterator over named capture groups as a tuple with the group name and the value."],["SubCapturesPos","An iterator over capture group positions for a particular match of a regular expression."]],"trait":[["Replacer","Replacer describes types that can be used to replace matches in a string."]]}); \ No newline at end of file diff --git a/regex/struct.Captures.html b/regex/struct.Captures.html new file mode 100644 index 0000000..aab73fd --- /dev/null +++ b/regex/struct.Captures.html @@ -0,0 +1,156 @@ + + + + + + + + + + regex::Captures - Rust + + + + + + + + + + + + + + + +
+

Struct regex::Captures + + [] + + [src]

+
pub struct Captures<'t> {
+    // some fields omitted
+}

Captures represents a group of captured strings for a single match.

+ +

The 0th capture always corresponds to the entire match. Each subsequent +index corresponds to the next capture group in the regex. +If a capture group is named, then the matched string is also available +via the name method. (Note that the 0th capture is always unnamed and so +must be accessed with the at method.)

+ +

Positions returned from a capture group are always byte indices.

+ +

't is the lifetime of the matched text.

+

Methods

impl<'t> Captures<'t>

fn pos(&self, i: usize) -> Option<(usize, usize)>

+

Returns the start and end positions of the Nth capture group. +Returns None if i is not a valid capture group or if the capture +group did not match anything. +The positions returned are always byte indices with respect to the +original string matched.

+

fn at(&self, i: usize) -> Option<&'t str>

+

Returns the matched string for the capture group i. If i isn't +a valid capture group or didn't match anything, then None is +returned.

+

fn name(&self, name: &str) -> Option<&'t str>

+

Returns the matched string for the capture group named name. If +name isn't a valid capture group or didn't match anything, then +None is returned.

+

fn iter(&'t self) -> SubCaptures<'t>

+

Creates an iterator of all the capture groups in order of appearance +in the regular expression.

+

fn iter_pos(&'t self) -> SubCapturesPos<'t>

+

Creates an iterator of all the capture group positions in order of +appearance in the regular expression. Positions are byte indices +in terms of the original string matched.

+

fn iter_named(&'t self) -> SubCapturesNamed<'t>

+

Creates an iterator of all named groups as an tuple with the group +name and the value. The iterator returns these values in arbitrary +order.

+

fn expand(&self, text: &str) -> String

+

Expands all instances of $name in text to the corresponding capture +group name.

+ +

name may be an integer corresponding to the index of the +capture group (counted by order of opening parenthesis where 0 is the +entire match) or it can be a name (consisting of letters, digits or +underscores) corresponding to a named capture group.

+ +

If name isn't a valid capture group (whether the name doesn't exist or +isn't a valid index), then it is replaced with the empty string.

+ +

To write a literal $ use $$.

+

fn len(&self) -> usize

+

Returns the number of captured groups.

+

fn is_empty(&self) -> bool

+

Returns true if and only if there are no captured groups.

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/regex/struct.FindCaptures.html b/regex/struct.FindCaptures.html new file mode 100644 index 0000000..c00aa36 --- /dev/null +++ b/regex/struct.FindCaptures.html @@ -0,0 +1,152 @@ + + + + + + + + + + regex::FindCaptures - Rust + + + + + + + + + + + + + + + +
+

Struct regex::FindCaptures + + [] + + [src]

+
pub struct FindCaptures<'r, 't> {
+    // some fields omitted
+}

An iterator that yields all non-overlapping capture groups matching a +particular regular expression.

+ +

The iterator stops when no more matches can be found.

+ +

'r is the lifetime of the compiled expression and 't is the lifetime +of the matched string.

+

Trait Implementations

impl<'r, 't> Iterator for FindCaptures<'r, 't>

type Item = Captures<'t>

+

fn next(&mut self) -> Option<Captures<'t>>

+

fn size_hint(&self) -> (usize, Option<usize>)

+

fn count(self) -> usize

+

fn last(self) -> Option<Self::Item>

+

fn nth(&mut self, n: usize) -> Option<Self::Item>

+

fn chain<U>(self, other: U) -> Chain<Self, U::IntoIter> where U: IntoIterator<Item=Self::Item>

+

fn zip<U>(self, other: U) -> Zip<Self, U::IntoIter> where U: IntoIterator

+

fn map<B, F>(self, f: F) -> Map<Self, F> where F: FnMut(Self::Item) -> B

+

fn filter<P>(self, predicate: P) -> Filter<Self, P> where P: FnMut(&Self::Item) -> bool

+

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F> where F: FnMut(Self::Item) -> Option<B>

+

fn enumerate(self) -> Enumerate<Self>

+

fn peekable(self) -> Peekable<Self>

+

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P> where P: FnMut(&Self::Item) -> bool

+

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P> where P: FnMut(&Self::Item) -> bool

+

fn skip(self, n: usize) -> Skip<Self>

+

fn take(self, n: usize) -> Take<Self>

+

fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F> where F: FnMut(&mut St, Self::Item) -> Option<B>

+

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F> where U: IntoIterator, F: FnMut(Self::Item) -> U

+

fn fuse(self) -> Fuse<Self>

+

fn inspect<F>(self, f: F) -> Inspect<Self, F> where F: FnMut(&Self::Item) -> ()

+

fn by_ref(&mut self) -> &mut Self

+

fn collect<B>(self) -> B where B: FromIterator<Self::Item>

+

fn partition<B, F>(self, f: F) -> (B, B) where B: Default + Extend<Self::Item>, F: FnMut(&Self::Item) -> bool

+

fn fold<B, F>(self, init: B, f: F) -> B where F: FnMut(B, Self::Item) -> B

+

fn all<F>(&mut self, f: F) -> bool where F: FnMut(Self::Item) -> bool

+

fn any<F>(&mut self, f: F) -> bool where F: FnMut(Self::Item) -> bool

+

fn find<P>(&mut self, predicate: P) -> Option<Self::Item> where P: FnMut(&Self::Item) -> bool

+

fn position<P>(&mut self, predicate: P) -> Option<usize> where P: FnMut(Self::Item) -> bool

+

fn rposition<P>(&mut self, predicate: P) -> Option<usize> where Self: ExactSizeIterator + DoubleEndedIterator, P: FnMut(Self::Item) -> bool

+

fn max(self) -> Option<Self::Item> where Self::Item: Ord

+

fn min(self) -> Option<Self::Item> where Self::Item: Ord

+

fn min_max(self) -> MinMaxResult<Self::Item> where Self::Item: Ord

+

fn max_by<B, F>(self, f: F) -> Option<Self::Item> where F: FnMut(&Self::Item) -> B, B: Ord

+

fn min_by<B, F>(self, f: F) -> Option<Self::Item> where F: FnMut(&Self::Item) -> B, B: Ord

+

fn rev(self) -> Rev<Self> where Self: DoubleEndedIterator

+

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB) where FromB: Default + Extend<B>, FromA: Default + Extend<A>, Self: Iterator<Item=(A, B)>

+

fn cloned<'a, T>(self) -> Cloned<Self> where T: 'a + Clone, Self: Iterator<Item=&'a T>

+

fn cycle(self) -> Cycle<Self> where Self: Clone

+

fn reverse_in_place<'a, T>(&mut self) where T: 'a, Self: Iterator<Item=&'a mut T> + DoubleEndedIterator

+

fn sum<S = Self::Item>(self) -> S where S: Add<Self::Item, Output=S> + Zero

+

fn product<P = Self::Item>(self) -> P where P: Mul<Self::Item, Output=P> + One

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/regex/struct.FindMatches.html b/regex/struct.FindMatches.html new file mode 100644 index 0000000..9ba87f0 --- /dev/null +++ b/regex/struct.FindMatches.html @@ -0,0 +1,153 @@ + + + + + + + + + + regex::FindMatches - Rust + + + + + + + + + + + + + + + +
+

Struct regex::FindMatches + + [] + + [src]

+
pub struct FindMatches<'r, 't> {
+    // some fields omitted
+}

An iterator over all non-overlapping matches for a particular string.

+ +

The iterator yields a tuple of integers corresponding to the start and end +of the match. The indices are byte offsets. The iterator stops when no more +matches can be found.

+ +

'r is the lifetime of the compiled expression and 't is the lifetime +of the matched string.

+

Trait Implementations

impl<'r, 't> Iterator for FindMatches<'r, 't>

type Item = (usize, usize)

+

fn next(&mut self) -> Option<(usize, usize)>

+

fn size_hint(&self) -> (usize, Option<usize>)

+

fn count(self) -> usize

+

fn last(self) -> Option<Self::Item>

+

fn nth(&mut self, n: usize) -> Option<Self::Item>

+

fn chain<U>(self, other: U) -> Chain<Self, U::IntoIter> where U: IntoIterator<Item=Self::Item>

+

fn zip<U>(self, other: U) -> Zip<Self, U::IntoIter> where U: IntoIterator

+

fn map<B, F>(self, f: F) -> Map<Self, F> where F: FnMut(Self::Item) -> B

+

fn filter<P>(self, predicate: P) -> Filter<Self, P> where P: FnMut(&Self::Item) -> bool

+

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F> where F: FnMut(Self::Item) -> Option<B>

+

fn enumerate(self) -> Enumerate<Self>

+

fn peekable(self) -> Peekable<Self>

+

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P> where P: FnMut(&Self::Item) -> bool

+

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P> where P: FnMut(&Self::Item) -> bool

+

fn skip(self, n: usize) -> Skip<Self>

+

fn take(self, n: usize) -> Take<Self>

+

fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F> where F: FnMut(&mut St, Self::Item) -> Option<B>

+

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F> where U: IntoIterator, F: FnMut(Self::Item) -> U

+

fn fuse(self) -> Fuse<Self>

+

fn inspect<F>(self, f: F) -> Inspect<Self, F> where F: FnMut(&Self::Item) -> ()

+

fn by_ref(&mut self) -> &mut Self

+

fn collect<B>(self) -> B where B: FromIterator<Self::Item>

+

fn partition<B, F>(self, f: F) -> (B, B) where B: Default + Extend<Self::Item>, F: FnMut(&Self::Item) -> bool

+

fn fold<B, F>(self, init: B, f: F) -> B where F: FnMut(B, Self::Item) -> B

+

fn all<F>(&mut self, f: F) -> bool where F: FnMut(Self::Item) -> bool

+

fn any<F>(&mut self, f: F) -> bool where F: FnMut(Self::Item) -> bool

+

fn find<P>(&mut self, predicate: P) -> Option<Self::Item> where P: FnMut(&Self::Item) -> bool

+

fn position<P>(&mut self, predicate: P) -> Option<usize> where P: FnMut(Self::Item) -> bool

+

fn rposition<P>(&mut self, predicate: P) -> Option<usize> where Self: ExactSizeIterator + DoubleEndedIterator, P: FnMut(Self::Item) -> bool

+

fn max(self) -> Option<Self::Item> where Self::Item: Ord

+

fn min(self) -> Option<Self::Item> where Self::Item: Ord

+

fn min_max(self) -> MinMaxResult<Self::Item> where Self::Item: Ord

+

fn max_by<B, F>(self, f: F) -> Option<Self::Item> where F: FnMut(&Self::Item) -> B, B: Ord

+

fn min_by<B, F>(self, f: F) -> Option<Self::Item> where F: FnMut(&Self::Item) -> B, B: Ord

+

fn rev(self) -> Rev<Self> where Self: DoubleEndedIterator

+

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB) where FromB: Default + Extend<B>, FromA: Default + Extend<A>, Self: Iterator<Item=(A, B)>

+

fn cloned<'a, T>(self) -> Cloned<Self> where T: 'a + Clone, Self: Iterator<Item=&'a T>

+

fn cycle(self) -> Cycle<Self> where Self: Clone

+

fn reverse_in_place<'a, T>(&mut self) where T: 'a, Self: Iterator<Item=&'a mut T> + DoubleEndedIterator

+

fn sum<S = Self::Item>(self) -> S where S: Add<Self::Item, Output=S> + Zero

+

fn product<P = Self::Item>(self) -> P where P: Mul<Self::Item, Output=P> + One

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/regex/struct.NoExpand.html b/regex/struct.NoExpand.html new file mode 100644 index 0000000..755c106 --- /dev/null +++ b/regex/struct.NoExpand.html @@ -0,0 +1,110 @@ + + + + + + + + + + regex::NoExpand - Rust + + + + + + + + + + + + + + + +
+

Struct regex::NoExpand + + [] + + [src]

+
pub struct NoExpand<'t>(pub &'t str);

NoExpand indicates literal string replacement.

+ +

It can be used with replace and replace_all to do a literal +string replacement without expanding $name to their corresponding +capture groups.

+ +

'r is the lifetime of the literal text.

+

Trait Implementations

impl<'t> Replacer for NoExpand<'t>

fn reg_replace<'a>(&'a mut self, _: &Captures) -> Cow<'a, str>

+

fn no_expand<'a>(&'a mut self) -> Option<Cow<'a, str>>

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/regex/struct.RegexSplits.html b/regex/struct.RegexSplits.html new file mode 100644 index 0000000..92d5b0d --- /dev/null +++ b/regex/struct.RegexSplits.html @@ -0,0 +1,149 @@ + + + + + + + + + + regex::RegexSplits - Rust + + + + + + + + + + + + + + + +
+

Struct regex::RegexSplits + + [] + + [src]

+
pub struct RegexSplits<'r, 't> {
+    // some fields omitted
+}

Yields all substrings delimited by a regular expression match.

+ +

'r is the lifetime of the compiled expression and 't is the lifetime +of the string being split.

+

Trait Implementations

impl<'r, 't> Iterator for RegexSplits<'r, 't>

type Item = &'t str

+

fn next(&mut self) -> Option<&'t str>

+

fn size_hint(&self) -> (usize, Option<usize>)

+

fn count(self) -> usize

+

fn last(self) -> Option<Self::Item>

+

fn nth(&mut self, n: usize) -> Option<Self::Item>

+

fn chain<U>(self, other: U) -> Chain<Self, U::IntoIter> where U: IntoIterator<Item=Self::Item>

+

fn zip<U>(self, other: U) -> Zip<Self, U::IntoIter> where U: IntoIterator

+

fn map<B, F>(self, f: F) -> Map<Self, F> where F: FnMut(Self::Item) -> B

+

fn filter<P>(self, predicate: P) -> Filter<Self, P> where P: FnMut(&Self::Item) -> bool

+

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F> where F: FnMut(Self::Item) -> Option<B>

+

fn enumerate(self) -> Enumerate<Self>

+

fn peekable(self) -> Peekable<Self>

+

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P> where P: FnMut(&Self::Item) -> bool

+

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P> where P: FnMut(&Self::Item) -> bool

+

fn skip(self, n: usize) -> Skip<Self>

+

fn take(self, n: usize) -> Take<Self>

+

fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F> where F: FnMut(&mut St, Self::Item) -> Option<B>

+

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F> where U: IntoIterator, F: FnMut(Self::Item) -> U

+

fn fuse(self) -> Fuse<Self>

+

fn inspect<F>(self, f: F) -> Inspect<Self, F> where F: FnMut(&Self::Item) -> ()

+

fn by_ref(&mut self) -> &mut Self

+

fn collect<B>(self) -> B where B: FromIterator<Self::Item>

+

fn partition<B, F>(self, f: F) -> (B, B) where B: Default + Extend<Self::Item>, F: FnMut(&Self::Item) -> bool

+

fn fold<B, F>(self, init: B, f: F) -> B where F: FnMut(B, Self::Item) -> B

+

fn all<F>(&mut self, f: F) -> bool where F: FnMut(Self::Item) -> bool

+

fn any<F>(&mut self, f: F) -> bool where F: FnMut(Self::Item) -> bool

+

fn find<P>(&mut self, predicate: P) -> Option<Self::Item> where P: FnMut(&Self::Item) -> bool

+

fn position<P>(&mut self, predicate: P) -> Option<usize> where P: FnMut(Self::Item) -> bool

+

fn rposition<P>(&mut self, predicate: P) -> Option<usize> where Self: ExactSizeIterator + DoubleEndedIterator, P: FnMut(Self::Item) -> bool

+

fn max(self) -> Option<Self::Item> where Self::Item: Ord

+

fn min(self) -> Option<Self::Item> where Self::Item: Ord

+

fn min_max(self) -> MinMaxResult<Self::Item> where Self::Item: Ord

+

fn max_by<B, F>(self, f: F) -> Option<Self::Item> where F: FnMut(&Self::Item) -> B, B: Ord

+

fn min_by<B, F>(self, f: F) -> Option<Self::Item> where F: FnMut(&Self::Item) -> B, B: Ord

+

fn rev(self) -> Rev<Self> where Self: DoubleEndedIterator

+

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB) where FromB: Default + Extend<B>, FromA: Default + Extend<A>, Self: Iterator<Item=(A, B)>

+

fn cloned<'a, T>(self) -> Cloned<Self> where T: 'a + Clone, Self: Iterator<Item=&'a T>

+

fn cycle(self) -> Cycle<Self> where Self: Clone

+

fn reverse_in_place<'a, T>(&mut self) where T: 'a, Self: Iterator<Item=&'a mut T> + DoubleEndedIterator

+

fn sum<S = Self::Item>(self) -> S where S: Add<Self::Item, Output=S> + Zero

+

fn product<P = Self::Item>(self) -> P where P: Mul<Self::Item, Output=P> + One

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/regex/struct.RegexSplitsN.html b/regex/struct.RegexSplitsN.html new file mode 100644 index 0000000..691941a --- /dev/null +++ b/regex/struct.RegexSplitsN.html @@ -0,0 +1,151 @@ + + + + + + + + + + regex::RegexSplitsN - Rust + + + + + + + + + + + + + + + +
+

Struct regex::RegexSplitsN + + [] + + [src]

+
pub struct RegexSplitsN<'r, 't> {
+    // some fields omitted
+}

Yields at most N substrings delimited by a regular expression match.

+ +

The last substring will be whatever remains after splitting.

+ +

'r is the lifetime of the compiled expression and 't is the lifetime +of the string being split.

+

Trait Implementations

impl<'r, 't> Iterator for RegexSplitsN<'r, 't>

type Item = &'t str

+

fn next(&mut self) -> Option<&'t str>

+

fn size_hint(&self) -> (usize, Option<usize>)

+

fn count(self) -> usize

+

fn last(self) -> Option<Self::Item>

+

fn nth(&mut self, n: usize) -> Option<Self::Item>

+

fn chain<U>(self, other: U) -> Chain<Self, U::IntoIter> where U: IntoIterator<Item=Self::Item>

+

fn zip<U>(self, other: U) -> Zip<Self, U::IntoIter> where U: IntoIterator

+

fn map<B, F>(self, f: F) -> Map<Self, F> where F: FnMut(Self::Item) -> B

+

fn filter<P>(self, predicate: P) -> Filter<Self, P> where P: FnMut(&Self::Item) -> bool

+

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F> where F: FnMut(Self::Item) -> Option<B>

+

fn enumerate(self) -> Enumerate<Self>

+

fn peekable(self) -> Peekable<Self>

+

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P> where P: FnMut(&Self::Item) -> bool

+

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P> where P: FnMut(&Self::Item) -> bool

+

fn skip(self, n: usize) -> Skip<Self>

+

fn take(self, n: usize) -> Take<Self>

+

fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F> where F: FnMut(&mut St, Self::Item) -> Option<B>

+

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F> where U: IntoIterator, F: FnMut(Self::Item) -> U

+

fn fuse(self) -> Fuse<Self>

+

fn inspect<F>(self, f: F) -> Inspect<Self, F> where F: FnMut(&Self::Item) -> ()

+

fn by_ref(&mut self) -> &mut Self

+

fn collect<B>(self) -> B where B: FromIterator<Self::Item>

+

fn partition<B, F>(self, f: F) -> (B, B) where B: Default + Extend<Self::Item>, F: FnMut(&Self::Item) -> bool

+

fn fold<B, F>(self, init: B, f: F) -> B where F: FnMut(B, Self::Item) -> B

+

fn all<F>(&mut self, f: F) -> bool where F: FnMut(Self::Item) -> bool

+

fn any<F>(&mut self, f: F) -> bool where F: FnMut(Self::Item) -> bool

+

fn find<P>(&mut self, predicate: P) -> Option<Self::Item> where P: FnMut(&Self::Item) -> bool

+

fn position<P>(&mut self, predicate: P) -> Option<usize> where P: FnMut(Self::Item) -> bool

+

fn rposition<P>(&mut self, predicate: P) -> Option<usize> where Self: ExactSizeIterator + DoubleEndedIterator, P: FnMut(Self::Item) -> bool

+

fn max(self) -> Option<Self::Item> where Self::Item: Ord

+

fn min(self) -> Option<Self::Item> where Self::Item: Ord

+

fn min_max(self) -> MinMaxResult<Self::Item> where Self::Item: Ord

+

fn max_by<B, F>(self, f: F) -> Option<Self::Item> where F: FnMut(&Self::Item) -> B, B: Ord

+

fn min_by<B, F>(self, f: F) -> Option<Self::Item> where F: FnMut(&Self::Item) -> B, B: Ord

+

fn rev(self) -> Rev<Self> where Self: DoubleEndedIterator

+

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB) where FromB: Default + Extend<B>, FromA: Default + Extend<A>, Self: Iterator<Item=(A, B)>

+

fn cloned<'a, T>(self) -> Cloned<Self> where T: 'a + Clone, Self: Iterator<Item=&'a T>

+

fn cycle(self) -> Cycle<Self> where Self: Clone

+

fn reverse_in_place<'a, T>(&mut self) where T: 'a, Self: Iterator<Item=&'a mut T> + DoubleEndedIterator

+

fn sum<S = Self::Item>(self) -> S where S: Add<Self::Item, Output=S> + Zero

+

fn product<P = Self::Item>(self) -> P where P: Mul<Self::Item, Output=P> + One

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/regex/struct.SubCaptures.html b/regex/struct.SubCaptures.html new file mode 100644 index 0000000..57b0e51 --- /dev/null +++ b/regex/struct.SubCaptures.html @@ -0,0 +1,149 @@ + + + + + + + + + + regex::SubCaptures - Rust + + + + + + + + + + + + + + + +
+

Struct regex::SubCaptures + + [] + + [src]

+
pub struct SubCaptures<'t> {
+    // some fields omitted
+}

An iterator over capture groups for a particular match of a regular +expression.

+ +

't is the lifetime of the matched text.

+

Trait Implementations

impl<'t> Iterator for SubCaptures<'t>

type Item = Option<&'t str>

+

fn next(&mut self) -> Option<Option<&'t str>>

+

fn size_hint(&self) -> (usize, Option<usize>)

+

fn count(self) -> usize

+

fn last(self) -> Option<Self::Item>

+

fn nth(&mut self, n: usize) -> Option<Self::Item>

+

fn chain<U>(self, other: U) -> Chain<Self, U::IntoIter> where U: IntoIterator<Item=Self::Item>

+

fn zip<U>(self, other: U) -> Zip<Self, U::IntoIter> where U: IntoIterator

+

fn map<B, F>(self, f: F) -> Map<Self, F> where F: FnMut(Self::Item) -> B

+

fn filter<P>(self, predicate: P) -> Filter<Self, P> where P: FnMut(&Self::Item) -> bool

+

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F> where F: FnMut(Self::Item) -> Option<B>

+

fn enumerate(self) -> Enumerate<Self>

+

fn peekable(self) -> Peekable<Self>

+

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P> where P: FnMut(&Self::Item) -> bool

+

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P> where P: FnMut(&Self::Item) -> bool

+

fn skip(self, n: usize) -> Skip<Self>

+

fn take(self, n: usize) -> Take<Self>

+

fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F> where F: FnMut(&mut St, Self::Item) -> Option<B>

+

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F> where U: IntoIterator, F: FnMut(Self::Item) -> U

+

fn fuse(self) -> Fuse<Self>

+

fn inspect<F>(self, f: F) -> Inspect<Self, F> where F: FnMut(&Self::Item) -> ()

+

fn by_ref(&mut self) -> &mut Self

+

fn collect<B>(self) -> B where B: FromIterator<Self::Item>

+

fn partition<B, F>(self, f: F) -> (B, B) where B: Default + Extend<Self::Item>, F: FnMut(&Self::Item) -> bool

+

fn fold<B, F>(self, init: B, f: F) -> B where F: FnMut(B, Self::Item) -> B

+

fn all<F>(&mut self, f: F) -> bool where F: FnMut(Self::Item) -> bool

+

fn any<F>(&mut self, f: F) -> bool where F: FnMut(Self::Item) -> bool

+

fn find<P>(&mut self, predicate: P) -> Option<Self::Item> where P: FnMut(&Self::Item) -> bool

+

fn position<P>(&mut self, predicate: P) -> Option<usize> where P: FnMut(Self::Item) -> bool

+

fn rposition<P>(&mut self, predicate: P) -> Option<usize> where Self: ExactSizeIterator + DoubleEndedIterator, P: FnMut(Self::Item) -> bool

+

fn max(self) -> Option<Self::Item> where Self::Item: Ord

+

fn min(self) -> Option<Self::Item> where Self::Item: Ord

+

fn min_max(self) -> MinMaxResult<Self::Item> where Self::Item: Ord

+

fn max_by<B, F>(self, f: F) -> Option<Self::Item> where F: FnMut(&Self::Item) -> B, B: Ord

+

fn min_by<B, F>(self, f: F) -> Option<Self::Item> where F: FnMut(&Self::Item) -> B, B: Ord

+

fn rev(self) -> Rev<Self> where Self: DoubleEndedIterator

+

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB) where FromB: Default + Extend<B>, FromA: Default + Extend<A>, Self: Iterator<Item=(A, B)>

+

fn cloned<'a, T>(self) -> Cloned<Self> where T: 'a + Clone, Self: Iterator<Item=&'a T>

+

fn cycle(self) -> Cycle<Self> where Self: Clone

+

fn reverse_in_place<'a, T>(&mut self) where T: 'a, Self: Iterator<Item=&'a mut T> + DoubleEndedIterator

+

fn sum<S = Self::Item>(self) -> S where S: Add<Self::Item, Output=S> + Zero

+

fn product<P = Self::Item>(self) -> P where P: Mul<Self::Item, Output=P> + One

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/regex/struct.SubCapturesNamed.html b/regex/struct.SubCapturesNamed.html new file mode 100644 index 0000000..4f6afc8 --- /dev/null +++ b/regex/struct.SubCapturesNamed.html @@ -0,0 +1,149 @@ + + + + + + + + + + regex::SubCapturesNamed - Rust + + + + + + + + + + + + + + + +
+

Struct regex::SubCapturesNamed + + [] + + [src]

+
pub struct SubCapturesNamed<'t> {
+    // some fields omitted
+}

An Iterator over named capture groups as a tuple with the group +name and the value.

+ +

't is the lifetime of the matched text.

+

Trait Implementations

impl<'t> Iterator for SubCapturesNamed<'t>

type Item = (&'t str, Option<&'t str>)

+

fn next(&mut self) -> Option<(&'t str, Option<&'t str>)>

+

fn size_hint(&self) -> (usize, Option<usize>)

+

fn count(self) -> usize

+

fn last(self) -> Option<Self::Item>

+

fn nth(&mut self, n: usize) -> Option<Self::Item>

+

fn chain<U>(self, other: U) -> Chain<Self, U::IntoIter> where U: IntoIterator<Item=Self::Item>

+

fn zip<U>(self, other: U) -> Zip<Self, U::IntoIter> where U: IntoIterator

+

fn map<B, F>(self, f: F) -> Map<Self, F> where F: FnMut(Self::Item) -> B

+

fn filter<P>(self, predicate: P) -> Filter<Self, P> where P: FnMut(&Self::Item) -> bool

+

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F> where F: FnMut(Self::Item) -> Option<B>

+

fn enumerate(self) -> Enumerate<Self>

+

fn peekable(self) -> Peekable<Self>

+

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P> where P: FnMut(&Self::Item) -> bool

+

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P> where P: FnMut(&Self::Item) -> bool

+

fn skip(self, n: usize) -> Skip<Self>

+

fn take(self, n: usize) -> Take<Self>

+

fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F> where F: FnMut(&mut St, Self::Item) -> Option<B>

+

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F> where U: IntoIterator, F: FnMut(Self::Item) -> U

+

fn fuse(self) -> Fuse<Self>

+

fn inspect<F>(self, f: F) -> Inspect<Self, F> where F: FnMut(&Self::Item) -> ()

+

fn by_ref(&mut self) -> &mut Self

+

fn collect<B>(self) -> B where B: FromIterator<Self::Item>

+

fn partition<B, F>(self, f: F) -> (B, B) where B: Default + Extend<Self::Item>, F: FnMut(&Self::Item) -> bool

+

fn fold<B, F>(self, init: B, f: F) -> B where F: FnMut(B, Self::Item) -> B

+

fn all<F>(&mut self, f: F) -> bool where F: FnMut(Self::Item) -> bool

+

fn any<F>(&mut self, f: F) -> bool where F: FnMut(Self::Item) -> bool

+

fn find<P>(&mut self, predicate: P) -> Option<Self::Item> where P: FnMut(&Self::Item) -> bool

+

fn position<P>(&mut self, predicate: P) -> Option<usize> where P: FnMut(Self::Item) -> bool

+

fn rposition<P>(&mut self, predicate: P) -> Option<usize> where Self: ExactSizeIterator + DoubleEndedIterator, P: FnMut(Self::Item) -> bool

+

fn max(self) -> Option<Self::Item> where Self::Item: Ord

+

fn min(self) -> Option<Self::Item> where Self::Item: Ord

+

fn min_max(self) -> MinMaxResult<Self::Item> where Self::Item: Ord

+

fn max_by<B, F>(self, f: F) -> Option<Self::Item> where F: FnMut(&Self::Item) -> B, B: Ord

+

fn min_by<B, F>(self, f: F) -> Option<Self::Item> where F: FnMut(&Self::Item) -> B, B: Ord

+

fn rev(self) -> Rev<Self> where Self: DoubleEndedIterator

+

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB) where FromB: Default + Extend<B>, FromA: Default + Extend<A>, Self: Iterator<Item=(A, B)>

+

fn cloned<'a, T>(self) -> Cloned<Self> where T: 'a + Clone, Self: Iterator<Item=&'a T>

+

fn cycle(self) -> Cycle<Self> where Self: Clone

+

fn reverse_in_place<'a, T>(&mut self) where T: 'a, Self: Iterator<Item=&'a mut T> + DoubleEndedIterator

+

fn sum<S = Self::Item>(self) -> S where S: Add<Self::Item, Output=S> + Zero

+

fn product<P = Self::Item>(self) -> P where P: Mul<Self::Item, Output=P> + One

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/regex/struct.SubCapturesPos.html b/regex/struct.SubCapturesPos.html new file mode 100644 index 0000000..c2860f8 --- /dev/null +++ b/regex/struct.SubCapturesPos.html @@ -0,0 +1,151 @@ + + + + + + + + + + regex::SubCapturesPos - Rust + + + + + + + + + + + + + + + +
+

Struct regex::SubCapturesPos + + [] + + [src]

+
pub struct SubCapturesPos<'t> {
+    // some fields omitted
+}

An iterator over capture group positions for a particular match of a +regular expression.

+ +

Positions are byte indices in terms of the original string matched.

+ +

't is the lifetime of the matched text.

+

Trait Implementations

impl<'t> Iterator for SubCapturesPos<'t>

type Item = Option<(usize, usize)>

+

fn next(&mut self) -> Option<Option<(usize, usize)>>

+

fn size_hint(&self) -> (usize, Option<usize>)

+

fn count(self) -> usize

+

fn last(self) -> Option<Self::Item>

+

fn nth(&mut self, n: usize) -> Option<Self::Item>

+

fn chain<U>(self, other: U) -> Chain<Self, U::IntoIter> where U: IntoIterator<Item=Self::Item>

+

fn zip<U>(self, other: U) -> Zip<Self, U::IntoIter> where U: IntoIterator

+

fn map<B, F>(self, f: F) -> Map<Self, F> where F: FnMut(Self::Item) -> B

+

fn filter<P>(self, predicate: P) -> Filter<Self, P> where P: FnMut(&Self::Item) -> bool

+

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F> where F: FnMut(Self::Item) -> Option<B>

+

fn enumerate(self) -> Enumerate<Self>

+

fn peekable(self) -> Peekable<Self>

+

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P> where P: FnMut(&Self::Item) -> bool

+

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P> where P: FnMut(&Self::Item) -> bool

+

fn skip(self, n: usize) -> Skip<Self>

+

fn take(self, n: usize) -> Take<Self>

+

fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F> where F: FnMut(&mut St, Self::Item) -> Option<B>

+

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F> where U: IntoIterator, F: FnMut(Self::Item) -> U

+

fn fuse(self) -> Fuse<Self>

+

fn inspect<F>(self, f: F) -> Inspect<Self, F> where F: FnMut(&Self::Item) -> ()

+

fn by_ref(&mut self) -> &mut Self

+

fn collect<B>(self) -> B where B: FromIterator<Self::Item>

+

fn partition<B, F>(self, f: F) -> (B, B) where B: Default + Extend<Self::Item>, F: FnMut(&Self::Item) -> bool

+

fn fold<B, F>(self, init: B, f: F) -> B where F: FnMut(B, Self::Item) -> B

+

fn all<F>(&mut self, f: F) -> bool where F: FnMut(Self::Item) -> bool

+

fn any<F>(&mut self, f: F) -> bool where F: FnMut(Self::Item) -> bool

+

fn find<P>(&mut self, predicate: P) -> Option<Self::Item> where P: FnMut(&Self::Item) -> bool

+

fn position<P>(&mut self, predicate: P) -> Option<usize> where P: FnMut(Self::Item) -> bool

+

fn rposition<P>(&mut self, predicate: P) -> Option<usize> where Self: ExactSizeIterator + DoubleEndedIterator, P: FnMut(Self::Item) -> bool

+

fn max(self) -> Option<Self::Item> where Self::Item: Ord

+

fn min(self) -> Option<Self::Item> where Self::Item: Ord

+

fn min_max(self) -> MinMaxResult<Self::Item> where Self::Item: Ord

+

fn max_by<B, F>(self, f: F) -> Option<Self::Item> where F: FnMut(&Self::Item) -> B, B: Ord

+

fn min_by<B, F>(self, f: F) -> Option<Self::Item> where F: FnMut(&Self::Item) -> B, B: Ord

+

fn rev(self) -> Rev<Self> where Self: DoubleEndedIterator

+

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB) where FromB: Default + Extend<B>, FromA: Default + Extend<A>, Self: Iterator<Item=(A, B)>

+

fn cloned<'a, T>(self) -> Cloned<Self> where T: 'a + Clone, Self: Iterator<Item=&'a T>

+

fn cycle(self) -> Cycle<Self> where Self: Clone

+

fn reverse_in_place<'a, T>(&mut self) where T: 'a, Self: Iterator<Item=&'a mut T> + DoubleEndedIterator

+

fn sum<S = Self::Item>(self) -> S where S: Add<Self::Item, Output=S> + Zero

+

fn product<P = Self::Item>(self) -> P where P: Mul<Self::Item, Output=P> + One

+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/regex/trait.Replacer.html b/regex/trait.Replacer.html new file mode 100644 index 0000000..d83f7b8 --- /dev/null +++ b/regex/trait.Replacer.html @@ -0,0 +1,125 @@ + + + + + + + + + + regex::Replacer - Rust + + + + + + + + + + + + + + + +
+

Trait regex::Replacer + + [] + + [src]

+
pub trait Replacer {
+    fn reg_replace<'a>(&'a mut self, caps: &Captures) -> Cow<'a, str>;
+
+    fn no_expand<'a>(&'a mut self) -> Option<Cow<'a, str>> { ... }
+}

Replacer describes types that can be used to replace matches in a string.

+
+

Required Methods

+
+

fn reg_replace<'a>(&'a mut self, caps: &Captures) -> Cow<'a, str>

Returns a possibly owned string that is used to replace the match +corresponding to the caps capture group.

+ +

The 'a lifetime refers to the lifetime of a borrowed string when +a new owned string isn't needed (e.g., for NoExpand).

+
+

Provided Methods

+
+

fn no_expand<'a>(&'a mut self) -> Option<Cow<'a, str>>

Returns a possibly owned string that never needs expansion.

+
+

Implementors

+
+ + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3