Unstoppable Domains

Preg_match help needed.

Spaceship Spaceship
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
•••
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
•••
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
•••
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
•••
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
•••
Appraise.net

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Live Options
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back