NameSilo

Preg_match help needed.

SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
Watch

bliss

VIP Member
Impact
15
PHP:
    $match_expression = '<br><span class\=a>(.*)\/<\/span><\/font>';
    preg_match($match_expression,$total,$matches); 
    return strip_tags($matches[1]);
Warning: preg_match() [function.preg-match]: Unknown modifier '<' in /home/website/public_html/directory/myscript.php on line 21
Is giving me an error. Why? I did not think you had to escape < and > operators.


-
 
Last edited:
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Try this:

PHP:
$match_expression = '/<br><span class\=a>(.*)/<\/span><\/font>/'; 
    preg_match($match_expression,$total,$matches);  
    return strip_tags($matches[1]);
 
0
Close
Found it. What you had was close thanks!

PHP:
$match_expression = '/<br><span class\=a>(.*)\/<\/span><\/font>/i';
preg_match($match_expression,$total,$matches); 
return strip_tags($matches[1])
 
0
Close
Remember that you have to escape the characters ^.[$()|*+?{\ (if you want to 'match' the character and not use their function) with a backslash everytime :).
 
0
Close
Dismounted: No, what was I missing was not one of those. It was the escape on the / and the /i at the very end, but yes that is always great to know.
 
Last edited:
0
Close
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Search: choose where to search from the All tab
Open the search at the top of any page. On the All tab, the list next to the search box lets you choose where to search: everything, all...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back