![]() |
What the fuck is wrong with my regex?
Code:
|<a\s[^>]*href\s*=\s*(\"??)'.$pData['profile_url'].'\\1[^>]*>'.$aData['link_backlink'].'<\/a> |
Try this, assuming I understand the question :)
Code:
<?php |
That doesn't work.
Pretty much it's looking for <a href="http://somesite.com">something</a> sounds easy, but it will also return true if theres other attributes in the a tag also. |
Code:
<? |
bump for kill switch
|
Quote:
Thanks anyway.. Bump. |
:thumbsup:thumbsup Bump
|
Here is a way to do it without regex
Code:
$dom = new DOMDocument(); |
PHP Code:
|
Quote:
What I need it to do is find any a tag, with the specified href and anchor, ignores other attributes but returns true if the a tag has both the anchor and href |
I don't entirely understand what you are trying to do but maybe this will help... :shrug:
Code:
$links = '<a rel="nofollow" href="http://www.google.com/" id="extra">google</a>\r\n'; |
Quote:
Quote:
Code:
<?php |
Quote:
You could either put the http:// part in the regexp like I did, or replace all / with \/ |
echo "I love google"; //for extra PR
|
Quote:
|
Quote:
|
Quote:
Code:
$uri = 'http://www.bing.com/'; |
Thanks for all the help, nation-x got me going with his function and it works perfectly.
|
Here is the final version for anyone that might need something similar... we found that there was a small issue with urls that had an ending slash... fixed.
Code:
<?php |
stupid gfy board :P double post
|
It's a good function for sure :) I only see one issue..
If the link has any extra info it isn't going to match. For example: Code:
$url = 'http://www.crazyfilth.com/'; |
Quote:
Code:
<?php Quote:
|
This is too complicated for me.
Merry Christmas Happy New Year |
Nice info Fris, Merry Christmas.
|
Good call on the follow up. I've since started using SIMPLE HTML DOM it's a PHP class that uses jQuery style selectors.
http://simplehtmldom.sourceforge.net/ So the original solution to this thread for accessing all anchor tag "hrefs" can be accomplished like this: Code:
// Create DOM from URL or file |
Awesome reply Levi, Merry Christmas to you too man!
|
All times are GMT -7. The time now is 04:54 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc