Regular Expressions 101

Community Patterns

Greatest common divisor


Regular Expression
ECMAScript (JavaScript)



Calculates the greatest common divisor of two numbers. Attention: pipes in the substitution separate alternatives. If one alternative does not match, the next alternative is tried if it exists. The substitution must be repeated until it cannot substitute further.

Submitted by luis140219 on GitHub - 9 years ago