Regular Expressions 101

Community Patterns

Match two multiplied arrays of number literals

1

Regular Expression
ECMAScript (JavaScript)

/
^(\[(\d+|(?:\d*\.\d+))(?:,\s*(\d+|(?:\d*\.\d+)))*\])\s*[\*x]\s*(\[(\d+|(?:\d*\.\d+))(?:,\s*(\d+|(?:\d*\.\d+)))*\])$
/
gm

Description

Matches exactly two arrays of number literals separated by a multiplication character, where that multiplication character is either an asterisk or an x, and an array is started with a left square bracket, and whose contents are separated by commas, and which ends with a right square bracket.

Unimportant whitespace is ignored.

Submitted by anonymous - 5 years ago