The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
hello every body,
I want to replce the number (between 7 to 11 digit) to (U can't post number) by using ereg_replace I made this $message = ereg_replace('[0-9]{7,11}','(u can't post number)',$message); but this will replace all number even that 1234678.gif or 12345678.jpg what I want that to replace only sprate number Neither *12345678 nor 12345678* mean if there is char. before or after number not replace the number .... Thanks ... |
#2
|
|||
|
|||
![]()
Take a look at the lookaround syntax described here: http://www.regular-expressions.info/refadv.html
You could use something like this: '[\d]{7,11}(?![\d]+)' This uses a zero-length look ahead. The problem with the look-behind is that some regex engines only allow plain text in the look-behind. But, if you know what could be before the number you are matching, you could craft that into the regex. I am sure there is a simpler way.... ![]() |
#3
|
|||
|
|||
![]() Quote:
before number not characters or = or : after number not characters or . I Waited for ur help :up: |
#4
|
|||
|
|||
![]() ![]() You can do this: PHP Code:
Basically what the code above is (supposed to be) doing is: * Find any series of characters that are not characters, = or : (0 or more), and capture that into \1 * Followed by 7 to 11 digits (not captured) * Followed by any non-character or ., and capture it into \2 And then replace that with the captured groups \1, your message, and \2. I think that you mentioned in your last post differs from your original post, but you get the idea, you can change this to suit your needs. |
#5
|
|||
|
|||
![]() Quote:
what I need it is diffrent PHP Code:
I don't want replace these 1234567.gif 123455678.jpg 1245663.swf =12345678 |
#6
|
||||
|
||||
![]()
<a href="http://www.regular-expressions.info/anchors.html" target="_blank">Use anchors.</a>
|
#7
|
||||
|
||||
![]()
hows about...
PHP Code:
|
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|