Comparing two strings

I am facing a similar problem where we have to compare two strings. I applied the regex to match it and it works fine for the string which dont have space between. However in case the matching string containg space, then its failing.

Please let me know how to tackle this.

Thanks in advance.

Have you tried http://rubular.com/ which is a Ruby regular expression editor and tester. Makes light work on regular expressions.