regex question
-
hi there i’m new to all of this, so please excuse lameness
what am i doing wrong here?
i’m trying to use regex to match for the first part of a post slug (each time the same slug is used it adds a hyphen and an incremented interger), so the slug could be: blue, blue-2, blue-3, etc
this line currently works in my header.php for the one off occurence of the slug blue-2:
if(is_page('blue-2')){echo "kubrickbgblue.jpg";} else
and i’m trying to replace that with something that matches any occurence of a slug starting with ‘blue’:
$blue = ereg("^[blue]", is_page); //i'm escaping both square brackets but they seem to have been stripped out in this post
//i think this should make $blue useable as a boolean
if($blue) {echo 'kubrickbgblue.jpg';} elsebut alas i’m having no joy
clearly i’m doing something wrong
any suggestions regex users out there?
- The topic ‘regex question’ is closed to new replies.