We establish pattern formation for a family of discrete and continuous functionals consisting of a perimeter term and a nonlocal term. In particular, we show that for both the continuous and discrete functionals the global minimizers are exact periodic stripes. One striking feature is that the minimizers are invariant under a smaller group of symmetries than the functional itself. In the literature this phenomenon is often referred to as symmetry breaking. In the continuous setting, to our knowledge this is the first example of a model with local/nonlocal terms in competition such that the functional is invariant under permutation of coordinates and the minimizers display a pattern formation which is one-dimensional. Such behaviour for a smaller range of exponents in the discrete setting was already shown in [1].where J is a positive constant, Per 1 is the 1-perimeter and | · | 1 is the 1-norm and K 1 (ζ) := 1 (|ζ|1+1) p . The perimeter term acts as short-range attracting force and the nonlocal term as repulsive long-range force. We consider J slightly below some critical constant J dsc c (resp. J c ) above which the minimizers are trivial. In order to make our problem well-posed we restrict the functional to [0, L) d -periodic sets. Assuming initially that E is composed of stripes, by using the reflection positivity technique one can see that there exists h * J such that periodic stripes of width and distance h * J are minimizers among sets composed of stripes.In the following theorems we show that such periodic stripes are actually global minimizers, as soon as L is an even multiple of h * J . Theorem 1.1 Let d ≥ 1, p ≥ d + 2. Then there exists τ 0 , such that for every 0 < J c − J < τ 0 , one has that for every k ∈ N and L = 2kh * J , the minimizers of F J,L are optimal periodic stripes. Theorem 1.2 Let d ≥ 1, p ≥ d + 2. Then there exists τ 0 , such that for every 0 < J dsc c − J < τ 0 , one has that for every k ∈ N and L = 2kh * J , the minimizers E J of F dsc J,L are optimal periodic stripes. Some of the ingredients of the paper are: a two-scale analysis, a rigidity result and application of the reflection positivity. In [1], the deviation from being a stripe is measured in terms of "angles" and "holes". Then, a lower bound in terms of "angles" and "holes" is shown. In the continuum one would like to find a characterization of nonoptimality in terms of geometric quantities. However, the discrete concepts namely "angle" and "hole" in the continuum are ill-posed. Moreover, a characterization of the geometry cannot reduce to just "angles" and "holes" due to E ⊂ R d and not E ⊂ Z d . For this reason one needs to find a decomposition of the functional into terms that measure in a certain sense how much a minimizer deviates from being a union of stripes. Such quantities have been introduced in [3] and in [2]. The rigidity estimate expresses the penalization for not being a union of stripes.