  With the aim of investigating how the magnetic field in solar active regions
(ARs) controls flare activity, i.e., whether a confined or eruptive flare
occurs, we analyze 106 flares of Geostationary Operational Environmental
Satellite (GOES) class $\geq$M1.0 during 2010$-$2019. We calculate mean
characteristic twist parameters $\alpha$$_{FPIL}$ within the "flaring polarity
inversion line" region and $\alpha$$_\mathrm{HFED}$ within the area of high
photospheric magnetic free energy density, which both provide measures of the
nonpotentiality of AR core region. Magnetic twist is thought to be related to
the driving force of electric current-driven instabilities, such as the helical
kink instability. We also calculate total unsigned magnetic flux
($\Phi$$_\mathrm{AR}$) of ARs producing the flare, which describes the strength
of the background field confinement. By considering both the constraining
effect of background magnetic fields and the magnetic non-potentiality of ARs,
we propose a new parameter $\alpha$/$\Phi$$_\mathrm{AR}$ to measure the
probability for a large flare to be associated with a coronal mass ejection
(CME). We find that in about 90\% of eruptive flares,
$\alpha$$_\mathrm{FPIL}$/$\Phi$$_\mathrm{AR}$ and
$\alpha$$_\mathrm{HFED}$/$\Phi$$_\mathrm{AR}$ are beyond critical values
(2.2$\times$$10^{-24}$ and 3.2$\times$$10^{-24}$ Mm$^{-1}$ Mx$^{-1}$), whereas
they are less than critical values in $\sim$ 80\% of confined flares. This
indicates that the new parameter $\alpha$/$\Phi$$_\mathrm{AR}$ is well able to
distinguish eruptive flares from confined flares. Our investigation suggests
that the relative measure of magnetic nonpotentiality within the AR core over
the restriction of the background field largely controls the capability of ARs
to produce eruptive flares.
