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

Idiom #83 Regex with character repetition

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

(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"
preg_match_all("/htt+p/", $r, $matches)
uses RegExpr;
with TRegExpr.Create('htt+p') do try
my $regex = qr/htt+p/;

print "Match!" if $input =~ /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();

Do you know the best way to do this in your language ?
New implementation...

Idiom created by


Related idioms