473,382 Members | 1,204 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,382 software developers and data experts.

Attempting* to use reg exp. Guidance needed O:)

Markus
6,050 Expert 4TB
So, i'm making a proxy, cos, well, i'm bored. I thought it'd be rather easy actually.. but alas, it requires reg exp's - one of my pet hates; just below class's.

Anyway, the code im using:
[php]
$_string = file_get_contents("http://myspace.com"); // myspace file.

$_reg = '#\"http://(.*)\"#'; // regular expression

preg_match($_reg, $_string, $_match);
echo htmlentities($_match[0]);
[/php]
This works... but it gives me this:
Expand|Select|Wrap|Line Numbers
  1. "http://x.myspacecdn.com/Modules/Common/Static/img/iphone.png" /><meta http-equiv="expires" content="0" /><meta http-equiv="Pragma" content="no-cache"
  2.  
when what i actually want is:
Expand|Select|Wrap|Line Numbers
  1. "http://x.myspacecdn.com/Modules/Common/Static/img/iphone.png"
  2.  
It stretches to the last quote on the current line.. when i want the first quote that comes after href=

Any ideas?
Feb 8 '08 #1
1 1139
oberon
14
Instead of matching with .*, you could match with [^\"]*. That way you will only match until first occurence of \".
Expand|Select|Wrap|Line Numbers
  1. $_reg = '#\"http://([^\"]*)\"#'; // regular expression
Mar 30 '08 #2

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

Similar topics

2
by: Ken Fine | last post by:
I would like some guidance regarding a "content scanner" I'm trying to build. This ASP widget will automatically scan remote web sites for certain kinds of content using a screen scraping component...
3
by: David | last post by:
I understand the need for n-tier architecture if an app is to be scaled-up for server farm deployments. And I can also appreciate that separating UI from business-logic from data-access is simply...
3
by: Harlin | last post by:
Hi, I installed the admin client on my WebSphere box. I am now attempting to connect to my DB2 server (on another box). I have been able to find the DB2 server, instance and needed databases....
11
by: Ken Durden | last post by:
I am in search of a comprehensive methodology of using these two object cleanup approaches to get rid of a number of bugs, unpleasantries, and cleanup-ordering issues we currently have in our...
0
by: Patrick.O.Ige | last post by:
This what i got from microsoft! GDluck Dear ASP.NET Customer, This alert is to advise you of the availability of a web page that discusses an investigation Microsoft is currently conducting...
10
by: Michael B. Trausch | last post by:
Alright... I am attempting to find a way to parse ANSI text from a telnet application. However, I am experiencing a bit of trouble. What I want to do is have all ANSI sequences _removed_ from...
0
nirmalsingh
by: nirmalsingh | last post by:
hai everybody, i am new to php. i have no idea to generate web based reports. i even dont know, where to start, how to display it and etc., i am seriously in need of guidance. plz guide me the way...
5
by: RvGrah | last post by:
I've built a small app to deploy my apps in a small domain, just for my own use when I make small updates to pass to my end users. My app uses File.Copy, and works fine except that it takes a long...
1
by: Rusty Hill | last post by:
In ASP.net 2.0 I need to create a scheduling page that allows my users to book/schedule/reserve six different surgery rooms. What the design calls for is one screen that has the daily schedule on...
3
by: Ian Semmel | last post by:
I am not new to computing, but I am to Java and wonder if anyone could point me in the right (or a) direction. Specifically, how are multi-tiered applications put together. There appears to be...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.