473,385 Members | 1,342 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

preg_match_all returns 1 or empty array

This code returns 1 with print_r($urls)
Expand|Select|Wrap|Line Numbers
  1. $pattern = '#^http://domain.com/(.*)(\w*)0\b#';
  2. preg_match_all($pattern, $email, $urls);
same code returns empty array with those two outputs:

1. print_r($urls, true)

2. print_r($urls[0], true)

like this:

1
Array
(
[0] => Array
(
)

[1] => Array
(
)

[2] => Array
(
)

)

2
Array
(
)

However, when I test code here, it works like charm

How can I get my values? It will be very nice to have them in a variables, like $url1, $url2...

Can anybody help? (Your time and effort is highly appreciated!)
Dec 25 '12 #1
1 2903
Issue solved 2 days ago. When I remove this:
Expand|Select|Wrap|Line Numbers
  1. ^
from my regexp $urls[0][0] outputs first url :)
Dec 27 '12 #2

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

Similar topics

1
by: Arjen | last post by:
IE 6 does not return the value of a dynamic option list. Mozilla performs fine. How can I get the value of a choice in IE? Simple example below. Option list is filled with first element of array...
1
by: Crazy Cat | last post by:
Hi, whenever the underlying query being called by EXEC in the following has an empty result set I get the following error -- Invalid Data for 'Numeric' when EXEC returns empty row. However if I...
1
by: dave | last post by:
I am having a problem i bleieve a number of other individuals have had before. I have tried the solutions found on the net however I still have the problem. I am hosting a web site on an...
0
by: Markus Ernst | last post by:
Hi In an application installed with PHP5 it looks like ftp_nlist() returns false if the directory is empty, instead of an empty array as it should according to the manual. On the original server...
2
by: Rohan | last post by:
how would i remove the empty array this is my function Private Function FindMeter(ByVal txt As String) As MeterAccountName Dim TempTxt(3) As String TempTxt = Strings.Split(Trim(Right(txt,...
0
by: dani.meier | last post by:
Hi I have a webservice which takes an Array as input. This Array is nullable and a null-array is treated different than an empty one. My propblem is now, that if I pass a null-array to the...
3
by: swapnaoe | last post by:
Hi all, An empty array declared in a called function is used as a pointer to hold the address of an object passed in the calling function. this is perfectly legal. {/*calling function*/ ......
2
by: flydev | last post by:
Hello, I have very little knowledge when it comes to SOAP, but a developer I'm working with says it will make things easier when passing data to/from client software and the mySQL database. Anyhow, I...
6
by: unpresedented | last post by:
I have this query (that runs on Oracle 10g database): SELECT ge.*, ge.concept AS glossarypivot FROM s_glossary_entries ge WHERE (ge.glossaryid = '161' OR ge.sourceglossaryid = '161') AND...
5
by: mike j | last post by:
Hi everyone, If anyone could help me with this problem I'd appreciate it greatly. Basically I have a simple table on my database. It is linked with a php form that I created on my site. The php...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.