# Difference between StringJoin and StringExpression

When does one need StringJoin as opposed to StringExpression? I don't know of an example where s1<>s2<>...<>sn works but s1~~s2~~...~~sn does not.

• From here "StringExpression is closely related to StringJoin, except nonstrings are allowed and lists are not flattened. For pure strings, they are equivalent." – Jason B. Nov 25 '15 at 12:31
• Generally, you should consider StringJoin as on operation for joining strings together, while StringExpression is meant for pattern matching strings when using functions like StringCases, StringMatchQ and StringPosition. A StringExpression is much more like a regular expression in that sense. – Sjoerd Smit May 8 '17 at 13:14

Based on @Jason B's comment, StringJoin can handle (and flattens) lists.
StringJoin[{"Ab", "cd"}, {"ef"}] returns Abcdef, whereas StringExpression[{"Ab", "cd"}, {"ef"}] returns {"Ab", "cd"} ~~ {"ef"}.
• But it works too, StringCases[ "bf", {"b", "d"} ~~ {"f"}], so what works better? :) – Kuba Nov 25 '15 at 13:05