Complex field conditions always create different interferences during seismic data acquisition, and there exist several types of noise in the recorded data, which affect the subsequent data processing and interpretation. To separate an effective signal from the noisy data, we adopted a pattern-based method with a two-step strategy, which involves two adaptive prediction-error filters (APEFs) corresponding to a nonstationary data pattern and noise pattern. By introducing shaping regularization, we first constructed a least-squares problem to estimate the filter coefficients of the APEF. Then, we solved another constrained least-square problem corresponding to the pattern-based signal-noise separation, and different pattern operators are adopted to characterize random noise and ground-roll noise. In comparison with traditional denoising methods, such as FXDECON, curvelet transform and local time-frequency (LTF) decomposition, we examined the ability of the proposed method by removing seismic random noise and ground-roll noise in several examples. Synthetic models and field data demonstrate the validity of the strategy for separating nonstationary signal and noise with different patterns.