Skip Navigation

[Resolved] Can I use REGEXP in condition ?

This support ticket is created 7 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by tinaH 7 years, 5 months ago.

Assisted by: Minesh.

Author
Posts
#531583

I am trying to use a regexp in a wpv_conditional.
Is this possible?
I'm unable to get it to work but maybe you can tweak it?

My goal is to setup this condition; if wpcf-homepage not begins with "http"

[wpv-conditional if="(  $(wpcf-homepage) ne 'REGEXP('^http')'  )"]
#531715

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

There is no native feature available to use REGEX with the conditional statement but what you should do is try to create custom shortcode OR function and pass your field value to it, validate your REGEX and pass boolean value true or false and use that custom shortcode or function with [wpv-conditional] shortcode.

More info:
=> https://toolset.com/documentation/user-guides/conditional-html-output-in-views/using-custom-functions-in-conditions/
=> https://toolset.com/documentation/user-guides/conditional-html-output-in-views/using-shortcodes-in-conditions/

#533411

OK, thank you