Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Rust

Idiom #83 Regex with character repetition

Declare the regular expression r matching the strings "http", "htttp", "httttp", etc.

extern crate regex;
use regex::Regex;
let r = Regex::new(r"htt+p").unwrap();

In order to avoid compiling the regex in every iteration of a loop, put it in a lazy static or something.
(def r #"htt+p")

New implementation...
< >
deleplace