Solved

i want to get specific string from a sentince

Posted on 2008-10-02
1
213 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
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now