![]() |
Combining 2 preg_replace statements
Can someone please tell me how I can combine to 2 following statements into one? I need to parse both of them out of the same code but they seem to cancel each other out.
PHP Code:
PHP Code:
|
The problem with regex is that you can match patterns with it, but you can't count with them. :(
The following pattern will do the match: ((.*)*(\[you\])*)* The problem is that due to the repeating nature of the pattern and the fact that it has sub patterns you can not code a replacement for it. :( You may be stuck with the 2 regex's... |
I don't mind doing 2, but they cancel each other out. One will work, but not the other. Whichever one comes last seems to work. How do I make then both work?
|
You said this would do the match. Is this how it should look (with the siU)?
PHP Code:
|
Not sure if I am being picky here but in the second preg_replace you should change the regex
from "/(\[)(you)(])/siU" to "/(\[)(you)(\])/siU" I don't see why they would cancel each other out... :confused: |
Quote:
What I meant was that the regex I gave would replace the (.*) in the first preg_replace and would try to match both patterns in your statements. But since the replacements need to be done in 2 passes, it is of no help... |
Quote:
|
All times are GMT. The time now is 03:33 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|