preg_match_all has some limits?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mauro D.

    preg_match_all has some limits?

    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{\pi ct\picscalex80\ picscaley80\pic cropl0\piccropr 0\piccropt0\pic cropb0\picw800\ pich600\picwgoa l12000\pichgoal 9000\jpeglib
    ....some binary data...}}

    RTF file is about 3,9MB and this expression "\{\\*\\shppict {\pict(.*?)}}/"

    doesn't return anything that i can change.

    My wish is to change attribute of the string that I have paste on the
    top and obviously change binary data!

    Thanks

    Mauro
  • Andy Hassall

    #2
    Re: preg_match_all has some limits?

    On Fri, 04 Nov 2005 09:23:48 GMT, "Mauro D." <mauro.destroSp ammmm@tinspam.i t>
    wrote:
    [color=blue]
    >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{\p ict\picscalex80 \picscaley80\pi ccropl0\piccrop r0\piccropt0\pi ccropb0\picw800 \pich600\picwgo al12000\pichgoa l9000\jpeglib
    >...some binary data...}}
    >
    >RTF file is about 3,9MB and this expression "\{\\*\\shppict {\pict(.*?)}}/"[/color]

    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):

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

    Comment

    Working...