//gm
Code Generator
JavaScript
//m
// Use with .match() or .matchAll() for globalPython
import re
pattern = re.compile(r'' | re.MULTILINE)
result = re.findall(pattern, text)Go
import "regexp"
re := regexp.MustCompile(`(?m)`)
result := re.FindAllString(text, -1)PHP
$$pattern = '//m';
$$result = preg_match_all($$pattern, $$text, $$matches);Rust
use regex::Regex;
let re = Regex::new(r"(?m)").unwrap();
let result = re.find_iter(text);Cheatsheet
Character Classes
.Any char except newline\dDigit (0–9)\DNon-digit\wWord (a-z, A-Z, 0-9, _)\WNon-word\sWhitespace\SNon-whitespaceQuantifiers
*0 or more+1 or more?0 or 1{n}Exactly n{n,}n or more{n,m}Between n and mAnchors & Groups
^Start of string$End of string\bWord boundary( )Capturing group(?: )Non-capturing group|Alternation (OR)Lookaround
(?= )Positive lookahead(?! )Negative lookahead[abc]Character class[^abc]Negated class[a-z]Range