The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||||
|
||||||
What am I doing wrong with this preg_match?
I'm working on a plugin and I'm trying to pull out quotes from a post message ($post[pagetext]). For some reason, it works if there's a quote->img->/img->/quote combination, but if there is any text inside the quote WITH an image, it won't pick it up.
here's my regex: $qc = preg_match_all("/(\[quote)(.*)(\[\/quote\])/i", $post[pagetext], $quotematches, PREG_SET_ORDER); here are some examples of the regex results: Quote:
Quote:
HOWEVER, in the following: Quote:
|
#2
|
||||
|
||||
I think you are forgetting to deal with the new line between the text and the image
|
#3
|
||||
|
||||
Have a look at how vBulletin finds quotes in strip_quotes().
|
#4
|
|||
|
|||
does (.*) not match newlines?
|
#5
|
||||
|
||||
You need to add a PCRE modifier for it to count new lines as well. IIRC, the modifier is m. However, you should still be using vBulletin's method of detecting quotes, as it does not use costly regex functions.
|
#6
|
|||
|
|||
Quote:
http://us2.php.net/pcre.pattern.modifiers |
#7
|
||||
|
||||
No, you add the m modifier at the end, next to the i for case insensitive matches. Kind of like the g modifier (makes it "global", which matches more than one on a single line)...
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|