Re: preg_match

From: Date: Sat, 20 Aug 2005 03:18:29 +0000
Subject: Re: preg_match
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-220984@lists.php.net to get a copy of this message
On Fri, August 19, 2005 6:35 am, John Nichel wrote: > Jon wrote: >> preg_match_all("/Charges \s\s+ $total x (.+) /siU", $single, >> $from_invoice); > > You'll probably need to assemble that expression first. The regex may > be seeing the dollar sign for your variable as an end of line > delimiter. Not a chance. PHP is gonna splice $total into the string ages and ages before PCRE sees it. Okay, microseconds before, really, but that's ages in electron time. :-) > $match = "/Charges\s{1,}" . $total . "\sx\s(.*)\s/siU"; > preg_match_all ( $match, $single, $from_invoice ); I still contend that $total has "/#" in it when it breaks. -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#220984) next »