Let Δ and Σ be two disjoint finite alphabets. Given a "pattern" R ∈ (Δ ∪ Σ)* and a "text" w ∈ Σ*, we consider the problem that consists in deciding whether there exists a morphism φ: (Δ ∪ Σ)* → Σ* with φ( a ) = a for every constant a ∈ Σ and such that φ( R ) is a factor of w . In the general case, this is an NP-complete problem. We study the two following restrictions: • is an arbitrary one-variable pattern with constants (elements in Σ) • is a two-variable pattern without constant. In the first case, we show that the problem may be solved by an O (| w | 2 ln | w |)-time algorithm. In the second case, we present a O (| w | 2 ln 2 | w |)-time algorithm for solving the question.