note 33386 deleted from function.ereg by kennyt

From: Date: Wed, 26 Jan 2005 03:48:13 +0000
Subject: note 33386 deleted from function.ereg by kennyt
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-83963@lists.php.net to get a copy of this message
Note Submitter: kelly at expresscopy dot com ---- I wanted to match zero or more whitespaces in a row, between two strings. Thought this might save somebody some pain: $myVar = "lefttext \n\t \r \n righttext"; The middle is just garbage whitespace, which can be different in different situations (in my case, I'm parsing PDFs for metadata). if(ereg("lefttext( |\n|\t|\r)*righttext",$myVar)) { echo("Validates!\n"); } else { echo("Does NOT validate.\n"); } The working part of the phrase is ( |\n|\t|\r)* - matches zero or more whitespaces.

« previous php.notes (#83963) next »