473,809 Members | 2,849 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting warning whlie using preg_match....

ashitpro
542 Recognized Expert Contributor
Hi everybody..

The error I am getting is

"Warning: preg_match() [function.preg-match]: Compilation failed: missing terminating ] "

This happened because I'd supplied syntactically wrong regular expression to preg_match.
This expression are to be supplied by user, so I don't have control over it.
I just want to suppress this error. I don't want this warning on browser.
I also tried using try catch block but no luck.

any help?

Regards,
Ashish
Sep 25 '08 #1
2 2174
Atli
5,058 Recognized Expert Expert
Try adding a @ in front of the function. That usually silences warnings like these.
Sep 25 '08 #2
ashitpro
542 Recognized Expert Contributor
Try adding a @ in front of the function. That usually silences warnings like these.

Thanks...It's done...
Thanks again...
Sep 25 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
6133
by: Nigel | last post by:
I have access to a page that stores data as HTML. The code has two comments around the data that I want to get called <!-- START --> and <!-- END --> Question is, how do i read the page and grab the code that is between these two comments Nigel
8
2722
by: laredotornado | last post by:
Hi, I'm using PHP 4 and trying to parse through HTML to look for HREF attributes of anchor tags and SRC attributes of IMG tags. Does anyone know of any libraries/freeware to help parse through HTML to find these things. Right now, I'm doing a lot of "strstr" calls, but there is probably a better way to do what I need. Thanks for any help, - Dave
3
1228
by: Michael | last post by:
I have been doing PHP for over a year now but when I came round to writing a script I discovered that there was a reasonably sizeable gap in my knowledge that I didn't even know where to start finding out about. Anyway this is a reasonably nooby question: If I have a script on http://url-a.com/script.php and I want to get some dynamic information of my friend's site at http://url-b.com/info.php , How can I get it? I need to use get...
3
3787
by: Baquanb | last post by:
I need to get some text between font tags but I only need the text in the last table. The code i'm using below will get text between all font tags anyone know how I can just get whats in TABLE3 font tags. $url = "http://www.mysite.com"; $data = implode("", file($url)); preg_match_all ("/<td>(*?)<\/td>/", $data, $matches); foreach ($matches as $match) {
5
7567
by: Mark Woodward | last post by:
Hi all, I'm trying to validate text in a HTML input field. How do I *allow* a single quote? // catch any nasty characters (eg !@#$%^&*()/\) $match = '/^+$/'; $valid_srch = preg_match($match, $res_description); if (!$valid_srch) { ...
1
2296
by: FLX | last post by:
Hello, I'm trying to scrape daily titles from http://www.doopes.com/?cat=35444&lang=1&num=5&mode=0&from=2007-09-04&to=2007-09-04&exc=&inc=&opt=0 But i'm getting lost using preg_match. Can someone help me with this script? Thanks in advance! <?php
13
5379
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...
8
4002
by: Thomas Mlynarczyk | last post by:
Hello, I want to split a given string into tokens which are defined by regexes: // example tokens - a bit more complex in real $tokens = array( 'NUMBER' ='~^\d+~', 'NAME' ='~^+~', 'ANY' ='~^.~' ); // make sure there is always a match
29
37516
pradeepjain
by: pradeepjain | last post by:
Hii, I need to know is there any way to get the mac id's of the machines accessing ma site! I want to make a access lock using the mac id's <?php function returnmacaddress() { // This code is under the GNU Public Licence // Written by michael_stankiewicz {don't spam} at yahoo {no spam} dot com // Tested only on linux, please report bugs // WARNING: the commands 'which' and 'arp' should be executable
0
9722
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9603
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10378
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
10391
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
6881
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
5550
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
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4333
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
3862
muto222
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.