|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-04-27 17:33 UTC] DPP <paul dot dovbush at gmail dot com>
[2007-04-27 17:43 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 23 15:00:01 2025 UTC |
Description: ------------ Parsing file with 10000 lines of following format: level + delim + [@xref_id@ + delim +] tag + [delim + line_value +] terminator level digit delim space xref_id alphanum tag alpha (english) line_value any (except terminator) terminator \r\n With regexp: $c=preg_match_all("/^\s*(\d+)\s+(@(\S+)@\s+)?(\w+)(\s+@(\S+)@\s*|.*)?$/Sm",$fp,$m,PREG_PATTERN_ORDER); Setting PCRE_UTF8 modifier slows whole script down 30 times (from 300ms to 9000ms). May be more accurate regexp here will be $c=preg_match_all("/^ *(\d+) +(@([^@\\n]+)@ +)?([^ \\n]+)( +@([^@\\n]+)@ *| +[^\\n]*)?$/m",$fp,$m,PREG_PATTERN_ORDER); But it changes nothing.