The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
help with a regular expression please
Say I have a string:
x!!x bbbbbdddd x!!x bbbbaaaaddddd x!!x bbbbcccccddddd How do I match the bbbb(.*)dddd that do NOT have an "x!!x" substring between them? Don't ask what for, just tell me how do to such regex. explode() is not an option for my purposes. Thanks. Ideally, it would be something like ([^x!!x]*), but that won't work for some reason. |
#2
|
||||
|
||||
lookahead/lookbehind assertions
|
#3
|
|||
|
|||
Example plz?
|
#4
|
||||
|
||||
> x!!x bbbbbdddd x!!x bbbbaaaaddddd x!!x bbbbcccccddddd
From this string, what would be your desired match(es)? |
#5
|
|||
|
|||
Hmm..
I just want to end up having bbbb moved as towards the closest ddddd, so that the result would be: x!!x bbbbdddd x!!x aaaabbbbddddd x!!x cccccbbbbddddd EDIT: Actually, nevermind. That won't work as desired because the corresponding bbbb and dddd could have inner pairs of x!!x between them, which would give an undesired result. So nvm... :P |
#6
|
||||
|
||||
PHP Code:
|
#7
|
|||
|
|||
Yes, that works. However, as I said, it could happen like.. let me explain.
<bbbb <bbbbaaaadddd> dddd> So here, my result would have to be: < <aaaabbbbdddd> bbbbdddd> However, because there is another <....> inside the outer <....>, there is no way to see the the first bbbb belongs to the latest dddd. Or is there? :P |
#8
|
||||
|
||||
<Disclaimer>
This Code is utterly bad </Disclaimer> PHP Code:
|
#9
|
|||
|
|||
Why is it utterly bad? Because of performance?
|
#10
|
||||
|
||||
Because it is recursive and not checked
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|