Last active
March 4, 2025 19:41
-
-
Save paceaux/7d1e2e6d9d63adab2758779c4870e168 to your computer and use it in GitHub Desktop.
English Language RegExes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const wordSeparatorsRegex = /—\.,;:!?‽¡¿⸘()\\[\\]{}<>«»…‘“”"\s/g; | |
/* | |
fuck | s|er|ed|ing, motherfucker | |
shit + s|ton|ing|ting, bullshit | |
dick + s|head|hole|ed | |
ass + hole|hat|face | |
cock +s | |
*/ | |
const profanityRegex = /((\b)?(fuck)(\w+)?)|((\b)?shit(\w+)?)|((\b)dick(\w+|\b))|((\b)ass(\w+|\b))|((\b)cocks?\b)|((\b)cunts?\b)|((\b)twats?\b)|(wtf)|(stfu)/gi; | |
/* | |
no + o, na + a, nu +u | |
nah, naw, nuh | |
nope | |
*/ | |
const negationRegex = /\b(n(o+(pe)?|a+(h|w)?|uh))\b/gi; | |
/* | |
ye + e, ya + a, yu + u | |
yay, yah, ya | |
yup | |
yeah | |
*/ | |
const affirmationRegex = /\b(y((e+|a+|u+)(a+)?(y|h|s|p)?)\b)/gi | |
/* | |
a, an, any | |
another | |
some | |
the, these | |
that, this, those | |
*/ | |
const articleAndDemonstrativeRegex = /\b(a(n(\b|y|other))?|some|th(e(se)?|at|is|ose))\b/gi; | |
/* | |
my, our | |
your, | |
his, her its, their | |
*/ | |
const possessiveRegex = /\b(my|your|his|her|its|our|their)\b/gi; | |
/* | |
about, above,... as, at | |
before, behind, below, beneath, beside, between, beyond | |
considering concerning | |
in, inside, into, inwards | |
of, off, on, onto, out, outside | |
*/ | |
const prepositionRegex = /\b(?:ab(out|ove)|across|after|against|along|among|around|a(s|t)|be(fore|hind|low|neath|side|tween|yond)|but|by|con(sidering|cerning)|despite|down|during|except|excluding|for|from|in(side|to|wards?)?|like|near|o(f+)|on(to)?|opposite|out(side)?|over|past|per|regarding|since|through(out)?|till|to(wards?)?|under(neath)?|unlike|until|up(on)?|via|with(in|out)?)\b/gi | |
/* | |
lil, little | |
same, some | |
*/ | |
const adjectiveRegex = /\b(?:small|big|large|li(l|ttle)|premium|s(a|o)me)|live|white|black|brown|nice|best|worst|good|bad|fat|stupid|dumb|chubby|random|weird|strange|quick|friendly|twitch|first|second|third|old|young\b/gi; | |
const helperVerbRegex = /\b(?:let'?s|gonna|go|will|have|can|wanna)\b/gi; | |
/* | |
I, you, we, it, he, she, they | |
*/ | |
const personalPronounRegex = /\b(i|you|we|it|s?he|they)\b/gi; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment