Logo

Programming-Idioms

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

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating material.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
(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");
import static java.util.regex.Pattern.compile;
import java.util.regex.Pattern;
Pattern r = compile("ht{2,}p");
r = "htt+p"
preg_match_all("/htt+p/", $r, $matches)
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")
from re import compile
r = compile('ht{2,}p')
r = /htt+p/
extern crate regex;
use regex::Regex;
let r = Regex::new(r"htt+p").unwrap();