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

selection tool on raster image
Hi!
I have to implement in my app a selection tool which lets users to select region of any shape

Executing an exe
Hi. I have some bizarre problem with exec (other any other method) to launch exe's. I am making a ga

Problem in back link
I have page where i have given javascript back link but when i click on it browser give a message

first few characters only
hi, does anyone know how to use PHP to take the first few words of a text and limit them? i have see

Taxonomy? Classification? Categorisation?
Not sure if there is a way around this classification problem
I have a supplier who produces

PHP page is blank
Hi Everyone,

I have a site in which I am able to open the first PHP webpage in my browser but

Problem with PHP/mySQL login code
Hello,

There is an error in my login script and I can't figure out what it is...
I believe

Using real time in php
I'm very average at PHP and im looking to introduce time to something on my site.
Its a sports si

PHP mail() with images
I'm trying to get images to send along with my HTML e-mail sent through PHP mail(). I only tried vie

Parse multirow HTML table
Hello all,
I have a site I am working on. Its a sports site and I am trying to add stats to a DB

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