You are here: Re: preg_match_all has some limits? « PHP Programming Language « IT news, forums, messages
Re: preg_match_all has some limits?

Posted by Andy Hassall on 11/05/05 00:22

On Fri, 04 Nov 2005 09:23:48 GMT, "Mauro D." <mauro.destroSpammmm@tinspam.it>
wrote:

>Hi guys,
>i'm trying to replace a picture inside an RTF file.
>
>I have found that this is the format the picture is described inside RTF:
>
>{\*\shppict{\pict\picscalex80\picscaley80\piccropl0\piccropr0\piccropt0\piccropb0\picw800\pich600\picwgoal12000\pichgoal9000\jpeglib
>...some binary data...}}
>
>RTF file is about 3,9MB and this expression "\{\\*\\shppict{\pict(.*?)}}/"

I'd switch to single quotes around the PHP string to avoid added confusion
with slashes - it's tricky enough already.

Consider for example (which appears in your expression):

"\\s"

The actual value of that string is:

\s

Because the first slash escapes the second in PHP, and the s is a literal
character.

So \s reaches the PCRE engine, which interprets this as "whitespace
character".

Do you want something more like (and I've not quite convinced this is right
either):

'/\{\\*\\\\shppict\\{\\\pict(.*?)}}/'
--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

 

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

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