We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Regular expression in conditional

How Do I?

oltremedia's avatar
oltremedia
28 posts
8 years ago
oltremedia's avatar oltremedia

Hi there!

In switchee i alway do:

{case value="#^P(\\d+)$#|''"} to check for pagination.

How do I do the same in a EE conditional?

Doing this throws an error: {if segment_2 ~ "#^P(\d+)$#|''"}

I have also tried to substitute | with | {if segment_2 ~ "#^P(\d+)$#|''"}

by the way this works but doesn’t work when segment_2 is empty

thanks Francesco

       
oltremedia's avatar
oltremedia
28 posts
8 years ago
oltremedia's avatar oltremedia

I wanted to edit my post but the forum gives me error 😊 so I’ll do it here:

In …I have also tried to substitute -> I <- I used the html entity

In … by the way this works I forgot to copy the tag: {if segment_2 ~ '#^P(\d+)$#'}

sorry.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.