RE: [PHP-GENERAL] Need RegEx Guru Help...

From: Date: Tue, 13 Jun 2000 17:02:40 +0000
Subject: RE: [PHP-GENERAL] Need RegEx Guru Help...
Groups: php.general 
Request: Send a blank email to php-general+get-1731@lists.php.net to get a copy of this message
There's nothing complex in those regexs that preg can't handle exception the quoted variables using the {} syntax. e.g., Change '${start}' to '$start'. -John > I have the following perl regexes that I am having trouble converting > into > PHP. I have even tried using the preg_split to no avail. > > Could someone please help? Or if there is a site you know of that can > help > convert perl regex to PHP, could you pass it along? > > Thanks, > Matthew > > $start = '-\*([a-zA-Z\-0-9]+)\*-\s'; > $t = '\*\*'; > $s = '\s\s'; > $d = '(\d+)'; > > # Regular expression variables > > $match_stats0 = > qr(${start}\[\*\sStat\s\*]\s$d\sfiles?\.\s\s$d\sof\s$d\sslots?\sopen); > $match_stats1 = > qr($start$t\s$d\spacks?\s$t$s$d\sof\s$d\sslots\sopen,\sRecord:\s(.*)); > $match_stats2 = > qr($start$t\s$d\spacks?\s$t$s$d\sof\s$d\sslots\sopen,\s(Max|Mi > n):\s(.+),\sRecord:\s(.*)); > $match_stats3 = > qr($start$t\s$d\spacks?\s$t$s$d\sof\s$d\sslots\sopen,\sQueue:\ > s(\d+)/(\d+)); > $match_bandwidth1 = > qr($start$t\sBandwidth\sUsage\s$t\sCurrent:\s(.*),\sCap:\s(.*) > ,\sRecord:\s(.*)); > $match_bandwidth2 = > qr($start$t\sBandwidth\sUsage\s$t\sCurrent:\s(.*),\sRecord:\s(.*)); > $match_pack = qr($start\#$d\s+${d}x\s+\[\s*(.+?)\]\s+(.*)); > $match_note = qr($start\s\^-\s+(.*)); > $match_totals = > qr(${start}Total\sOffered:\s(.*)${s}Total\s(?:Transferred|Snag > ged):\s(.*)); > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: > php-list-admin@lists.php.net >

« previous php.general (#1731) next »