I should try to write a regular expression of the set of strings of even length over $\{k,l,m\}$ that contain exactly one $k$. If string has even length, and if we have one $k$; there should be (odd length $l$ and even length $m$) or (even length $m$ and odd length $l$). However, I couldn't show them, especially place of $k$ in the expression.
I hope I could tell my ideas correctly.
I'm not sure what rules are available for your definition of regular expression, but following works in Unix (as an extended regular expression):
([lm][lm])*(k[lm]|[lm]k)([lm][lm])*Edit: (I also removed the unnecessary anchors that Milo Brandt comments on.)
Breaking this down:
[lm]= represents a single character that could be eitherlorm. In the wikipedia regex page, this would be expressed by(l|m).( ) * |all mean the same as explained in the Basic Concepts section of the Wikipedia Regular Expressions page.([lm][lm])*is thus a string of any even number ofls andms.(k[lm]|[lm]k)is eitherkfollowed by anlor anm, or it is anlormfollowed by ak.So the whole expressions says "a string starting with any number of any of the substrings
ll, lm, ml, mm, followed by one of the substringskl, km, lk, lm, followed by any number of any of the substringsll, lm, ml, mm.Every string from $\{m, l, k\}$ of even length with exactly one $k$ in it will match this.