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

Form a inline view based on the results of the previous query?
Hi Experts,
Can we form a inline view on the results of a previous query (another inline view)?

function not returning the correct value
I have a program that needs to return a value from a function. I have an output statement inside the

Multiple websites question.
Hi, does php have any functionality that enables a programmer to extract information from a website

Async WSAConnect failed on XP with error code = 2 ("File not found")
Hi all,

I have very strange bug, please help me if you can.

It is reproduced o

timed header image rotation
I have a joomla site and I was trying to setup a rotating image based on timing NOT just refreshing

Varible in trigger - refering to correct schema
Hello

Im having some issues with my trigger.
What I want to do is call opon a differ

Help with php code
Hello, can anyone tell me why this php word trap fails to work,
and the trigger words get blow r

Quick Question about echo value
Hey guys, I'm trying to get something to show differently in one of my scripts. I'm trying to make

ALV List Display to point to another report on Double Click
Hi,

I want my ALV List Display to point to another report on Double Click on its line ite

Including calander to page - will not show other months than current??
im trying to add an existaing calander onto a profile page by using Code: <?php include "

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