You are here: Re: preg_match_all() and css classes « PHP Language « IT news, forums, messages
Re: preg_match_all() and css classes

Posted by Oli Filth on 11/20/57 11:26

kevinC said the following on 12/09/2005 21:39:
> Hello,
>
> I'm trying to parse out the properties of a class definition from a css
> file and am running into issues trying to write the reg. expression:
>
> h1 {
> font-family: Verdana, Arial, Helvetica, sans-serif;
> font-size: 16px;
> font-weight: bold;
> color: #003399;
> }
> ...
>
> I need the results in:
> array[i][0] = "h1"
> array[i][1] = "
> font-family: Verdana, Arial, Helvetica, sans-serif;
> font-size: 16px;
> font-weight: bold;
> color: #003399;"
>
> Any idea? I tried looking online for an example and can't find anything
> that works with php's preg_match_all() function...
>


preg_match_all('/\s*(.*)\s*\{\s*(.*)\s*\}/sU', $str, $array,
PREG_SET_ORDER);


--
Oli

 

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

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