473,799 Members | 3,005 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Preg_match and Preg_replace trouble regular expressions Please HELP!

need to extract all text between the following strings, but not
include the strings.
"<!-- #BeginEditable "Title name" -->"
"<p align="center"> #### </p>"
I am using preg_match(???? , $s, $results)
but I have had no success. I tried items like.. "<!-- #BeginEditable
"Title name" -->".*."<p align="center"> #### </p>"
But have had no luck.
Please any assistenc is appreciated.
In addition, I need to use preg_replace to replace the following:
<a href="/folder2/folder1/folder/*page.html">
with
<a href="site.com= page.php?option *=paper&itemid= page.html">
Again, any help is appreciated. The regular expressions confuse me, my

brain is about to explode from all the trouble shooting, I guess I'm
just not smart emough to figure it out.
PLEASE HELP!!
thanks

Aug 1 '05
22 2776
your correct, "<hat" was in the source. any idea on the next issue?

Aug 7 '05 #21
Somebody wrote:
preg_match("/\"Title of Firmrecall\".*/",$s,$resul t);

echo $result[0];

displays....
"Title of Firmrecall" The following is the title and

When it should be
"Title of Firmrecall" The following is the title and
this is the next line of the title.
The dot doesn't match newline characters. The s pattern
modifier changes its default meaning so that it matches
newlines as well.

/\"Title of Firmrecall\".*/s
PLEASE HELP!!! I've been working at this non stop but can not get it
working, I'm disperate!!!


It's Sunday, give it a rest for a while, and make the most of
it before it becomes Monday morning.

--
Jock
Aug 7 '05 #22
John,

THANK YOU!!!!!!!!!

I got it working! I'm giving it a rest, THANK YOU THANK YOU!!!!!!
THANK YOU!!

I 'm going to relax now and enjoy the rest of my day, maybe go
swimming! PLEASE ENJOY YOUR DAY AS WELL!!!!

THANK YOU!!!!

Aug 7 '05 #23

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

Similar topics

3
4899
by: Juha Suni | last post by:
Hi! I have managed to live without using too much regular expressions so far, and now that I need one, I need some help too. I have a string containing a (possibly large) block of html. I need to insert code (an image to be precise) right after the last textual character in the string. This is, of course, no problem if the end contains plain text and no html. If the string ends in HTML however, I need to fiddle around. for example...
3
2824
by: Marco Snoek | last post by:
Hi, Hope you can help me out with this one.. nl2br($string) converts all the \n to <br \> ... but .. Suppose I have a table or other HTML elements in $string.. All the TD> and TR> and FORM> are trailed by <br />
2
4461
by: pomho | last post by:
Hi all, Even having read the PHP Manual, I can't understand the difference between the ereg function and the preg_match... Could anyone help ? thx in advance, --
14
7184
by: Westcoast Sheri | last post by:
What is the most efficient way of extracting the first two digits in a string? The following is wrong for me, because it only gives me the first instance of two digits together: $string = ujdk3ca94abc preg_match("/\d{2}/",$string,$result); echo "$result"; //prints 94. However, the result I am looking for is 39
2
8559
by: Muumac | last post by:
I have problem with large textfiles! When I load over 4MB xml and then try to preg_match something in this I get always FALSE! I have <File>....</File> tags in XML. Between tags is files contents BASE64 encoded! When xml contains only one big over 4MB file in it, preg_match and preg_match_all doesnt find it! When included file size is nelow 4MB, preg functions works perfectly! But PHP manual says that there is no size limitations to...
16
2893
by: bissatch | last post by:
Hi, I am trying to use preg_replace to take out all occurances of PHP code after reading (fread()) the contents of a PHP file. The code I am using is: $html = preg_replace("<?php*?>", "", $html); Unfortuntely it is not working and giving the following error:
4
13978
by: Clodoaldo Pinto | last post by:
preg_match(): Compilation failed: regular expression too large at offset 0 The regular expression is 34,745 bytes long. <?php $regExp = 'huge regexp with 34,745 bytes'; echo '<pre>strlen($regExp) = ', strlen($regExp), "\n"; echo preg_match($regExp, 'sudokusweb.com'); echo '</pre>';
3
1015
by: Silvertype | last post by:
Hi guys, I have these html tags: <input type="text" id="txtName" name="txtName" /> <textarea id="taHello" name="taHello">hello world</textarea> which I want to replace with the following tags:
13
5375
by: chadsspameateremail | last post by:
I might have found a problem with how preg_match works though I'm not sure. Lets say you have a regular expression that you want to match a string of numbers. You might write the code like this: preg_match( '/^+$/', $TestString ); OK everything seems fine. However, did you know if you pass the following to preg_match: "12345\n" it will return that a match occurred?!? Even though the newline is not a valid character in our regular...
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...
1
10247
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10031
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
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...
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
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5593
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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.