I have no idea what you are asking. Please elaborate and provide context plus examples. And be sure to review the FAQ.
I need to search for a meta_value text that contains double quotes chars [“].
Eg. $myUnescapedString = ‘.*”city”;s:[0-9]+:”naples”.*’;
How can I escape double quotes chars?
For some reason my phone didn’t show me the first post, so all I got was the “no way”, which didn’t make any sense early in the morning.
SUL supports just about everything in the WP_Query but meta_compare=regex isn’t something that exists as far as I can tell: https://codex.wordpress.org/Class_Reference/WP_Meta_Query
Your best bet is probably to do something custom via the query_id parameter.
[userlist query_id="my_custom_meta_query"]
Now filter the pre_user_query, but only target this specific userlist via the query_id.
add_action('pre_user_query','kia_custom_user_list');
function kia_custom_user_list( $u_query ) {
if ( isset( $u_query->query_vars['query_id'] ) && $u_query->query_vars['query_id'] == 'my_custom_meta_query' ) {
//$u_query->query_where .= ' AND (
( wp_usermeta.meta_key = 'wp_s2member_custom_fields' AND wp_usermeta.meta_value = 'something' );
}
}
I don’t actually know if you can use regex in SQL and writing the specific query is beyond the level of support I provide for this plugin (even if I knew how to do it, which I don’t).
Hope that puts you on the right path. Also check out the FAQ, b/c I know S2member filters the pre_user_query too and that may have adverse effects.
Actually, I solved my problem using pre_user_query.
I was asking if there would be a better/simpler solution.
Thank you anyway and congrats for your work.
PS.
compare (string) – Operator to test. Possible values […] ‘REGEXP’, ‘NOT REGEXP’ and ‘RLIKE’ were added in WordPress 3.7
I did not know that. Then you should be able to automatically pass meta_compare="REGEXP" like you’ve done, since SUL is just a “pass through” for query parameters. I’ve tested
[userlist meta_key="last_name" meta_value="^Dar" meta_compare="REGEXP"]
and it fetches all users whose last names start with “Dar”. So the problem must be your regex, but that’s voodoo to me, so I couldn’t advise. Perhaps escape the ” like \” ? I really have no idea.