Stuck with preg_replace


Posted on 16th Feb 2014 07:03 pm by admin

Hi,

I'm trying to use preg_replace to remove part of the IP address submitted using a form on my website. The full IP is entered into my SQL database, but when printing it on the website I want to remove some numbers, so turn for example: 82.132.196.45 into 82.132.***.** when printed on the page.

Did you know?Explore Trending and Topic pages for more stories like this.
I find preg_replace very hard to use, though, and the PHP manual isn't very helpful for those who don't know what all the /wd<>\n type things mean. I need to not only match numerals and replace each numeral with an asterisk, but get preg_replace to ignore the first two groups of numbers. I know this means telling the function to only pay attention to anything after the second dot, but don't know how.

Can anyone assist please?
No comments posted yet

Your Answer:

Login to answer
292 Like 42 Dislike
Previous forums Next forums
Other forums

Loops and Classes
I am making a template system and everything seems to be going well up until I have to loop in a var

limit string by words??
hello all,

I was wonder if there is a function to limit a string by the number of words inste

Dynamic memory problem
Hey,

At the beginning of my code, I have this line:

Shape* gShape = 0;

Why does my crawler script suddenly end with no error?
Hi.

I have written a web crawler script. It will visit a large number of URL's with cURL.

Filtering an Array Based on Value
I have a very simple script set up that pulls data from a database and is output using this code:

code help - pagination
Hi all, I have this code, basically a user logs into my site and they get this page.

The pro

Load file in PHP
I have 2 files. The first is a PHP generated XML file that's dependent by 2 inputs. The second is a

Database/Table Collation
What is the Database, and table collations used for? i don't understand what there used for since co

IP Logger for Voting Script
Can anybody help me place an IP logger into my voting script?
I know that maybe it is not as secu

Error when call dll from oracle
Hi all, please help me!

I have dll write C language, I want call it from oracle procedur

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash