code: def test_replace_regex_inplace(using_copy_on_write):
      df = DataFrame({"a": ["aaa", "bbb"]})
      arr = get_array(df, "a")
      df.replace(
          to_replace=r"^a.*$", value="new", inplace=True, regex=True
      )
      if using_copy_on_write:
          assert df._mgr._has_no_reference(0)
      assert np.shares_memory(arr, get_array(df, "a"))
  
      df_orig = df.copy()
      df2 = df.replace(to_replace=r"^b.*$", value="new", regex=True)
      tm.assert_frame_equal(df_orig, df)
      assert not np.shares_memory(
          get_array(df2, "a"), get_array(df, "a")
      )
  
imports: import numpy
  import pytest
  from pandas import Categorical, DataFrame, option_context
  import pandas._testing
  from pandas.tests.copy_view.util import get_array
label_desc: Use image node_id 3 for calling a global function with example usage: test_replace_regex_inplace(using_copy_on_write) without return types