I have a string like this one
str = "this and that but also thit and that";Now I want to extract, the first 3 letters before and after " and " so that the outcome is
{his and tha, hit and tha}I tried it with
StringCases[str, x__ ~~ " and " ~~ y__ :> {StringTake[x, -3], StringTake[y, 3]}]but this extracts only the second substring {{"hit", "tha"}}. And using StringCases[str, _ ~~ " and " ~~ _] extracts only one letter {"s and t", "t and t"}. So is there a way to define a Blank with a particular length?