I found this query in mysql query log and I will like to know what exactly does it do.
select * from tblname WHERE TRIM(NAME) REGEXP 'John[ ]*Smith'
It selects all rows from tblname where name (with spaces around removed, if any) equals to John<any number of spaces>Smith
So you'll find JohnSmith as well as John_________________________Smith (stackoverflow eats repetitive spaces, so I replaced them with underscore).
The regex itself is a little bloated and can be rewritten as John *Smith