I want to accept only those strings having the pattern \'wild.flower\', \'pink.flower\',...i.e any word preceding \'.flower\', but the word should not contain dot. For example,
To match any character except a newline or a dot you could use a negated character class [^.\r\n]+
and repeat that one or more times and use anchors to assert the start ^
and the end $
of the line.
^[^.\r\n]+\.flower$
Or you could specify in a character class which characters you would allow to match followed by a dot \.
and flower
.
^[a-z0-9]+\.flower$