diff --git a/flake8_array_spacing/__init__.py b/flake8_array_spacing/__init__.py
index 052b4b0..b19694d 100644
--- a/flake8_array_spacing/__init__.py
+++ b/flake8_array_spacing/__init__.py
@@ -9,9 +9,50 @@ __version__ = '0.1.dev0'
 
 # This could almost certainly be better, it just checks for [...]
 # (no pairing within, or checking that i/j are attached to a number, etc.)
-ARRAY_LIKE_REGEX = re.compile(
-    r'[\[(][0-9 ij,+\-*^\/&|\[\]]*[\]),;]'
+_FMT = dict(
+    VARIABLE=r'[_a-z]+[_a-z0-9]*',
+    OPERATORS=r'[+\-*\/^\|&]',
+    SEPARATORS=r'[+\-*\/^\|& ,\[\]()]',
+    NUMERICAL=r"""
+(
+[0-9.]+(e[+-]?[0-9.]+)?j?|
+(np\.|numpy\.)?(nan|inf)|
 )
+""")
+
+_FMT['NUMERICAL_LIST'] = r"""
+[\[(]+  # >= 1 left bracket or paren
+({SEPARATORS}*{NUMERICAL}{SEPARATORS}*)+  # >= 1 numerical
+[\])]+  # >= 1 right bracket or paren
+""".format(**_FMT)
+
+_FMT['ARRAY_WITH_BINARY_OPS'] = r"""
+array\([\[(]+  # open array
+(
+    {SEPARATORS}*
+    (
+        {NUMERICAL}|
+        (
+            ({VARIABLE}|{NUMERICAL})
+            \ *
+            {OPERATORS}
+            \ *
+            ({VARIABLE}|{NUMERICAL})
+        )
+
+    )
+    {SEPARATORS}*
+)+  # at least one numerical-or-variable-with-binary-op
+[\])]+\)  # close array
+""".format(**_FMT)
+
+ARRAY_LIKE_REGEXP = re.compile("""(?x)
+(
+{NUMERICAL_LIST}
+|
+{ARRAY_WITH_BINARY_OPS}
+)""".format(**_FMT))
+
 FUNC_KINDS = (
     (extraneous_whitespace, ('E201', 'E202')),
     (whitespace_around_operator, ('E221', 'E222')),
@@ -35,7 +76,7 @@ class ArraySpacing(object):
         if self._array_ranges is None:
             self._array_ranges = [
                 (match.start() + 1, match.end() + 1)
-                for match in ARRAY_LIKE_REGEX.finditer(self.logical_line)]
+                for match in ARRAY_LIKE_REGEXP.finditer(self.logical_line)]
         return any(start <= idx <= end for start, end in self._array_ranges)
 
     def ignoring(self, kind):

BUG: Regex should be more complete/selective
It should be more selective (matching `[` and maybe ensuring any `i/j` are immediately preceded by numbers, currently it's pretty basic:
```
ARRAY_LIKE_REGEX = re.compile(
    r'[\[(][0-9 ij,+\-*^\/&|\[\]]*[\]),;]'
)
```

@jnothman I know you work on sklearn, @agramfort mentioned this might be useful for you all, too. Any interest in improving the regex [here](https://github.com/larsoner/flake8-array-spacing/blob/master/flake8_array_spacing/__init__.py#L12-L14), and maybe adopting this for sklearn?

Basically this plugin will replace `E` error variants:
```
    extraneous_whitespace,  # 201, 202
    whitespace_around_operator,  # 221, 222
    whitespace_around_comma,  # 241
```
With `A2XX` versions, where the ones above are ignored if they occur within an array-like list of (list of) numerical values. So you basically run an equivalent of `flake8 --ignore E201,E202,E203,E221,E222,E241 --select=A` and it should work. This came up originally for [scipy](https://github.com/scipy/scipy/issues/12367) (WIP PR to add this plugin [here](https://github.com/scipy/scipy/pull/12516/files)) but I imagine you all might have been annoyed about this at some point, too, so wanted to loop you in.
diff --git a/flake8_array_spacing/tests/test_array_spacing.py b/flake8_array_spacing/tests/test_array_spacing.py
index d411f3f..269699e 100644
--- a/flake8_array_spacing/tests/test_array_spacing.py
+++ b/flake8_array_spacing/tests/test_array_spacing.py
@@ -1,4 +1,5 @@
 import subprocess
+from textwrap import dedent
 import pytest
 
 
@@ -7,8 +8,8 @@ def flake8(path, *args):
     import os
     os.chdir(str(path))
     proc = subprocess.run(
-        ['flake8', '--select', 'A2',
-         '--ignore', 'E201,E202,E203,E221,E222,E241', '.'] + list(args),
+        ['flake8', '--select', 'F,A2',
+         '--ignore', 'E201,E202,E203,E221,E222,E241,F821', '.'] + list(args),
         stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     stderr = proc.stderr.decode().strip()
     assert stderr == ''
@@ -22,25 +23,45 @@ def test_installed():
     assert 'array-spacing' in out
 
 
-a_b_pre = 'a = 1\nb = 2\n'
-
-
-@pytest.mark.parametrize('line, want_output, want_code', [
-    ('[ -3  + 4j ,  -10 +  20j ]', '', 0),
-    (a_b_pre + '[a, b]', '', 0),
-    (a_b_pre + '[ a, b]', "./bad.py:3:2: A201 whitespace after '['", 1),
-    (a_b_pre + '[a, b ]', "./bad.py:3:6: A202 whitespace before ']'", 1),
-    (a_b_pre + '[a  + b, b]', "./bad.py:3:3: A221 multiple spaces before operator", 1),  # noqa: E501
-    (a_b_pre + '[a +  b, b]', "./bad.py:3:5: A222 multiple spaces after operator", 1),  # noqa: E501
-    (a_b_pre + '[a,  b]', "./bad.py:3:4: A241 multiple spaces after ','", 1),
-    (a_b_pre + '[a,  b]  # noqa', '', 0),
-    (a_b_pre + '[a,  b]  # noqa: E241', '', 0),
+@pytest.mark.parametrize('content, output', [
+    ("""
+     array([[x / 2.0,       0.],
+            [0.,      -y / 2.0]])'""", ''),
+    ("""
+     np.array([[x / 2.0,       0.],
+               [0.,      -y / 2.0]])'""", ''),
+    ('[[x / 2.0,       0.], [0.,      -y / 2.0]]', """\
+     ./bad.py:1:11: A241 multiple spaces after ','
+     ./bad.py:1:27: A241 multiple spaces after ','"""),
+    ('[ -3.  + 4.1j + 2,  -10e-2 +  20e+2j ]', ''),
+    ('[[ 1  , 2 ]  ,  [3, 4]]', ''),
+    ('[[ a  , b ]  ,  [a, b]]', """\
+     ./bad.py:1:3: A201 whitespace after '['
+     ./bad.py:1:10: A202 whitespace before ']'
+     ./bad.py:1:15: A241 multiple spaces after ','"""),
+    ('[ np.inf , 1  , 2 , numpy.nan , -inf  ]', ''),
+    ('[a, b]', ''),
+    ('[ a, b]', "./bad.py:1:2: A201 whitespace after '['"),
+    ('[a, b ]', "./bad.py:1:6: A202 whitespace before ']'"),
+    ('[a  + b, b]',
+     "./bad.py:1:3: A221 multiple spaces before operator"),
+    ('[a +  b, b]',
+    "./bad.py:1:5: A222 multiple spaces after operator"),  # noqa: E501
+    ('[ a,  b ]', """\
+     ./bad.py:1:2: A201 whitespace after '['
+     ./bad.py:1:5: A241 multiple spaces after ','
+     ./bad.py:1:8: A202 whitespace before ']'"""),
+    ('[a,  b]', "./bad.py:1:4: A241 multiple spaces after ','"),
+    ('[a,  b]  # noqa', ''),
+    ('[a,  b]  # noqa: E241', ''),
 ])
-def test_array_spacing(line, want_output, want_code, tmpdir):
+def test_array_spacing(content, output, tmpdir):
     """Test some cases."""
+    content = dedent(content)
+    output = dedent(output)
     fname = tmpdir.join('bad.py')
     with open(fname, 'w') as fid:
-        fid.write(line)
+        fid.write(content)
     got_output, got_code = flake8(tmpdir)
-    assert got_output == want_output
-    assert got_code == want_code
+    assert got_output == output
+    assert got_code == (1 if output else 0)

pip install -e .
parse_log_pytest
pytest
pytest
pip install flake8 check-manifest
3.9
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
build==1.2.2.post1
check-manifest==0.50
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
flake8==7.2.0
-e git+https://github.com/larsoner/flake8-array-spacing.git@7dd499e8413ca4a354aed926e337e05434b9b6fb#egg=flake8_array_spacing
importlib_metadata==8.6.1
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
mccabe==0.7.0
packaging @ file:///croot/packaging_1734472117206/work
pluggy @ file:///croot/pluggy_1733169602837/work
pycodestyle==2.13.0
pyflakes==3.3.2
pyproject_hooks==1.2.0
pytest @ file:///croot/pytest_1738938843180/work
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
zipp==3.21.0

name: flake8-array-spacing
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - exceptiongroup=1.2.0=py39h06a4308_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - packaging=24.2=py39h06a4308_0
  - pip=25.0=py39h06a4308_0
  - pluggy=1.5.0=py39h06a4308_0
  - pytest=8.3.4=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tomli=2.0.1=py39h06a4308_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - build==1.2.2.post1
      - check-manifest==0.50
      - flake8==7.2.0
      - importlib-metadata==8.6.1
      - mccabe==0.7.0
      - pycodestyle==2.13.0
      - pyflakes==3.3.2
      - pyproject-hooks==1.2.0
      - zipp==3.21.0
prefix: /opt/conda/envs/flake8-array-spacing

flake8_array_spacing/tests/test_array_spacing.py::test_array_spacing[[
flake8_array_spacing/tests/test_array_spacing.py::test_installed
flake8_array_spacing/tests/test_array_spacing.py::test_array_spacing[\n flake8_array_spacing/tests/test_array_spacing.py::test_array_spacing[[[x flake8_array_spacing/tests/test_array_spacing.py::test_array_spacing[[[ flake8_array_spacing/tests/test_array_spacing.py::test_array_spacing[[a, flake8_array_spacing/tests/test_array_spacing.py::test_array_spacing[[a
flake8_array_spacing/__init__.py
flake8_array_spacing/__init__.py