![]() |
RegEx problem..
Could anyone tell me why this regex pattern..
[php] <a href="http://www\.test\.com/lyrics/[^/]+/[^/]+/[^\.]+\.html" title="[^"]+"[^>]*>[^(<b>)\<]+</a> [/php] ..isn't matching this line? :
<a href="http://www.test.com/lyrics/a_lyrics_4179/lyrics_12737/everybody_in_lyrics_148006.html" title="Everybody In lyrics">Everybody In</a><br>This is my code.. [php] if (preg_match('~<a href="http://www\.test\.com/lyrics/[^/]+/[^/]+/[^\.]+\.html" title="[^"]+"[^>]*>[^(<b>)\<]+</a>~', $line)) { [/php] I don't want lines with "<b>" included..... isn't that the right way to do it? By enclosing a series of characters in parentheses? Thanks! |
[ ] indicates a character class. Only individual characters go in there, not characters grouped with ( ).
|
So anything I can do to achieve what I want to do?
|
It seems to be as if the best way to debug the regular expression is to remove successively greater parts of it until it works, and thus identify the part of the regular expression that is failing to match.
|
You'd either have to take out that (<b>) part towards the end or put it somewhere around there as (^<b>)
|
| All times are GMT -5. The time now is 3:06 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC