Reply to Some help on using regex

Your name:

Reply:


Posted by Jamie on 03/26/05 14:29

Hi everyone.

Im having a problem matcing some code using preg_match_all. The regex
statement needs to be very flexiable. The code im using is:

<project>(\n| |.)+<project>

to match the code. This code is being used to read project data is being
read from a socket and i need a way of spliting up the separate project
data. The regex above selects all the projects in one go down to the last
project statement. I guess instead of using the <project> tag (the start of
the next project). I need to match the </result> tag if the next line is
<project> or EOF. But im not sure how to do this. Does anyone have any
advice or help? Or have any sites that has a decent reference guide?

Thanks
Jamie

-==- Output from socket -==-
<project>
<master_url>http://climateprediction.net/</master_url>
<project_name>climateprediction.net</project_name>
<user_name>Bob</user_name>
<team_name></team_name>
<email_hash>gr432this444has333been888changed</email_hash>
<cross_project_id>FF035ggs5changedthisthis2sse25fb</cross_project_id>
<user_total_credit>9640.785061</user_total_credit>
<user_expavg_credit>28.001977</user_expavg_credit>
<user_create_time>1093683684.000000</user_create_time>
<rpc_seqno>132</rpc_seqno>
<hostid>40622</hostid>
<host_total_credit>9640.785061</host_total_credit>
<host_expavg_credit>28.001976</host_expavg_credit>
<host_create_time>1095354186.000000</host_create_time>
<exp_avg_cpu>86400.000000</exp_avg_cpu>
<exp_avg_mod_time>1105262213.578125</exp_avg_mod_time>
<nrpc_failures>0</nrpc_failures>
<master_fetch_failures>0</master_fetch_failures>
<min_rpc_time>0.000000</min_rpc_time>
<debt>1724.869789</debt>
<resource_share>120.000000</resource_share>
</project>
<app>
<name>hadsm3</name>
</app>
<app_version>
<app_name>hadsm3</app_name>
<version_num>404</version_num>
<file_ref>
<file_name>hadsm3_4.04_windows_intelx86.exe</file_name>
<main_program/>
</file_ref>
<file_ref>
<file_name>hadsm3data_4.04_windows_intelx86.zip</file_name>
<open_name>hadsm3data_4.04_windows_intelx86.zip</open_name>
</file_ref>
<file_ref>
<file_name>hadsm3se_4.04_windows_intelx86.zip</file_name>
<open_name>hadsm3se_4.04_windows_intelx86.zip</open_name>
</file_ref>
<file_ref>
<file_name>hadsm3um_4.04_windows_intelx86.zip</file_name>
<open_name>hadsm3um_4.04_windows_intelx86.zip</open_name>
</file_ref>
</app_version>
<workunit>
<name>2uzw_000154831</name>
<app_name>hadsm3</app_name>
<version_num>404</version_num>
<rsc_fpops_est>2461104000000000.000000</rsc_fpops_est>
<rsc_fpops_bound>24611040000000000.000000</rsc_fpops_bound>
<rsc_memory_bound>60000000.000000</rsc_memory_bound>
<rsc_disk_bound>600000000.000000</rsc_disk_bound>
<command_line>
2uzw_000154831
</command_line>
<file_ref>
<file_name>2uzw_000154831.zip</file_name>
<open_name>2uzw_000154831.zip</open_name>
</file_ref>
</workunit>
<result>
<name>2uzw_000154831_1</name>
<wu_name>2uzw_000154831</wu_name>
<project_url>http://climateprediction.net/</project_url>
<final_cpu_time>1248051.515625</final_cpu_time>
<exit_status>0</exit_status>
<state>2</state>
<report_deadline>1134868322.000000</report_deadline>
<estimated_cpu_time_remaining>2623817.482888</estimated_cpu_time_remaining>
<active_task>
<project_master_url>http://climateprediction.net/</project_master_url>
<result_name>2uzw_000154831_1</result_name>
<active_task_state>0</active_task_state>
<app_version_num>404</app_version_num>
<slot>0</slot>
<scheduler_state>1</scheduler_state>
<checkpoint_cpu_time>1248051.515625</checkpoint_cpu_time>
<fraction_done>0.322363</fraction_done>
<current_cpu_time>1248192.875000</current_cpu_time>
<vm_bytes>0.000000</vm_bytes>
</active_task>
</result>
<project>
.... next project details

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация