473,486 Members | 2,407 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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{\pict\picscalex80\picscaley80\piccropl 0\piccropr0\piccropt0\piccropb0\picw800\pich600\pi cwgoal12000\pichgoal9000\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
Nov 4 '05 #1
1 2142
On Fri, 04 Nov 2005 09:23:48 GMT, "Mauro D." <ma*****************@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\piccrop l0\piccropr0\piccropt0\piccropb0\picw800\pich600\p icwgoal12000\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 :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Nov 4 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4677
by: Han | last post by:
I'm wondering if someone can explain why the following works with preg_match_all, but not preg_match: $html = "product=3456789&amp;" preg_match_all ("|product=(\d{5,10})&amp;|i", $html, $out); $out...
3
7281
by: Han | last post by:
I know this is possible (because preg can do almost anything!), but can't get a handle on the syntax. I have an HTML string: <font size="3"><a...
10
2018
by: greatprovider | last post by:
i'm starting with a string such as "Na**3C**6H**5O**7*2H**20" im attempting to match all **\d+ ...once i can match all the double asterix \d i intend to wrap the \d in "<sub>" tags for display...
9
4994
by: Shuan | last post by:
I am getting this error. Can it be fixed by setting more than 60 for the max_execution_time in php.in file? Fatal error: Maximum execution time of 60 seconds exceeded in categorycrawler.php on...
2
1285
by: Gilles Ganault | last post by:
Hello I need to extract some bits of information from a web page, so I used preg_match_all. I was wondering if there's a simpler algorithm, or if that's the way it's done: ===========...
1
1260
by: dysfunct | last post by:
I'm running a script that at one point will collect <imgtags from some html. I've been using the following: preg_match_all("/<img .*?>/",$html,$images); and I thought it was working well....
3
3994
by: Anthony Smith | last post by:
I am trying to take a web page and get all of the links. It almost works, but I am missing a few links. Here is what I am using. preg_match_all('/href=?(*)?*>(.*?)<\/a>/i',...
10
2665
by: swethak | last post by:
hi, i write the below code to capture the images from the website when i submit the url.In the same way i want to capture the Text information from the website.plz tell that whats the code for...
2
8212
loriann
by: loriann | last post by:
hi, I have a problem with preg_match function returning empty arrays for my wonderful regexes. However, I can't see what I am doing wrong - maybe one of you could help? I'm loading the source...
0
7100
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6964
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7126
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7175
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6842
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7330
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4559
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.