Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
Select your favorite languages :
  • Or search :

Idiom #83 Regex with character repetition

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

preg_match_all("/htt+p/", $r, $matches)
(def r #"htt+p")
 auto r = regex("htt+p");
using System.Text.RegularExpressions;
var r = new Regex("htt+p");
import std.regex;
auto r = regex("htt+p");
r = Regex.compile!("htt+p")
import "regexp"
r := regexp.MustCompile("htt+p")
import Text.Regexp.Posix
r :: String -> Bool
r = (=~ "htt+p")
const r = /htt+p/
import java.util.regex.Pattern;
Pattern r = Pattern.compile("htt+p");
r = "htt+p"
uses RegExpr;
with TRegExpr.Create('htt+p') do try
finally
  free;
end;
my $r = qr/htt+p/;
import re
r = re.compile(r"htt+p")
r = /htt+p/
extern crate regex;
use regex::Regex;
let r = Regex::new(r"htt+p").unwrap();

New implementation...
< >
deleplace