in reply to Its not working.. String works but not split

Might not be trimming $string2 properly, eg, spaces, \r or other characters which are hard to see.

Some things to try: