You are here: Re: Problems with regex « All PHP « IT news, forums, messages
Re: Problems with regex

Posted by steve on 10/13/68 11:30

are elements always in the same order? if so, you could try:

(\[[^\]*\])

if you need the label as well as the value regardless of order, you could
try:

(.{2})(\[[^\]*\])

hth,

me


"Peter Stidsen" <peter@stidsen.dk> wrote in message
news:43542e4c$0$8781$edfadb0f@dread14.news.tele.dk...
| Hi,
|
| I need to get some info from a string, and I was told to Google for regex.
| Honestly I still don't have a clue about what to do.
|
|
|
| $string = "(;GM[1]FF[4]CA[UTF-8]AP[CGoban:2]ST[2]
| RU[Japanese]SZ[19]KM[0.50]TM[600]OT[25/240 Canadian]
| PW[winifred]PB[artipode]WR[8k]BR[9k]DT[2004-03-05]PC[The Kiseido Go Server
| (KGS) at http://kgs.kiseido.com/]RE[W+115.50] (...)"
|
| From this I need to find a way to:
| $pw = "winifred"
| $pb = "artipode"
| $wr = "8k"
| $br = "9k"
| $dt = "2004-03-05"
| $re = "W+115.50"
| $pc = "The Kiseido Go Server (KGS) at http://kgs.kiseido.com/"
|
| It's the value that is important, not the stringname. I just need to know
| what comes from where.
|
| Any help or points in the right dirrection is much appreciated.
|
| Thanks in advance
|
| Peter

 

Navigation:

[Reply to this 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

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