Deal with multiline properly

The original code treated whitespaces and non directional characters like comma as ltr characters and resulted in recognizing strings that contained those characters or multiple lines as, and only rtl characters as bidi strings