Clean up parsed meta_query clauses before performing preg_replaces() in BP_Groups_Group::get_meta_query_sql()

Some weaknesses in parsing were exposed by upstream changes. See
https://core.trac.wordpress.org/ticket/25538#comment:23.

This changeset makes the parsing less brittle by relying less on the details of
the line breaks introduced by WP into the query string.

See #5682

git-svn-id: https://buddypress.svn.wordpress.org/trunk@8476 cdf35c40-ae34-48e0-9cc9-0c9da1808c22