473,799 Members | 2,972 Online
Bytes | Software Development & Data Engineering Community
+ 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{\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
Nov 4 '05 #1
1 2156
On Fri, 04 Nov 2005 09:23:48 GMT, "Mauro D." <ma************ *****@tinspam.i t>
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{\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(.*?)}}/"


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 :: an**@andyh.co.u k :: 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
4697
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 = 3456789 preg_match ("|product=(\d{5,10})&amp;|i", $html, $out);
3
7297
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 href="http://www.example.com?product=3456789&amp;company=3528"> Mickey Mouse</a></font><br><img width="200" height="200" border="0" src="http://www.example.com/images/3456789.jpg"><b>$8.00</b>
10
2043
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 purposes. i have been trying to write the correct pattern for 2 weeks now without any success...i can get preg_replace() to work, with several simple patterns but when i use preg_match_all, i either get unintended results or incomplete matches.
9
5026
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 line 19 on this line i have regular expression preg_match_all(,,)
2
1303
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: =========== preg_match_all("|$regex|smi",$buffer,$matches,PREG_PATTERN_ORDER); $elements=sizeof($matches);
1
1274
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. However, I've notice that some things i throw at it don't work properly. It seems to be that and image tag closing itself with "/>" doesn't work, ie <img src="..... " / Admittedly I know very little about regular expressions. Anyone know whats going...
3
4024
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', $s,$matches,PREG_SET_ORDER); It will not pick up links like this: <a class="highlight" href="browse.php?region=West
10
2700
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 that.plz help me. <?php $content= file_get_contents($url);
2
8268
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 of a website into variable and then using preg_match_all to extract all occurrences of a string. it looks like this (where source code is loaded into $page variable): preg_match ('/<div\s+?id="srNum_\d+?"\s+?class="number">(.*?)<\/div>/', $page,...
0
10491
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10268
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9079
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7571
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6809
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5593
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4146
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.