Solved

i want to get specific string from a sentince

Posted on 2008-10-02
1
245 Views
Last Modified: 2012-05-05
$link="http://fdsafacom/files/1610943/fsadfsdf.rar<br /><b>Password: rdsd</b></div> </div>"
$link1=http://fdsfsdf/files/1610943/fdsff.rar

i want a command that takes this both and only output http://fdsafacom/files/1610943/fsadfsdf.rar
the second one
http://fdsfsdf/files/1610943/fdsff.rar

i have this one but i dose not work
preg_match_all('/(http:\/\/[^\"]+)/i', $page, $links);
it give me in the first link
http://fdsafacom/files/1610943/fsadfsdf.rar<br /><b>Password: rdsd</b></div> </div>"
0
Comment
Question by:mgtm3
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 15

Accepted Solution

by:
ncoo earned 500 total points
ID: 22625216
You need to add a don't match < like below:
$page="$link=\"http://fdsafacom/files/1610943/fsadfsdf.rar<br /><b>Password: rdsd</b></div> </div>\"
$link1=http://fdsfsdf/files/1610943/fdsff.rar";
preg_match_all('/(http:\/\/[^\"^<]+)/i', $page, $links);
print_r($links);

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This article discusses four methods for overlaying images in a container on a web page
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question