edit to clarify: oneword is a searchquery a user might use. I need to match both oneword, one word or word one with this regex
how to match a string with or without whitespace in any given order?
This is my current query /^(?=.*one)(?=.*word).*$/i
credits: http://www.rubular.com/r/QFEfj9lMn3
So given the text
oneword one word word one and the searchquery /^(?=.*one)(?=.*word).*$/i matches all three, but /^(?=.*oneword).*$/i only matches the first part of the text.
Are there better ways to fix this than by adding one optional character in front of every single letter?
thanks