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

problems with php variables in mysql query
i can't seem to get the following query to work.

select $q1c from $vote_rate where id = $re

Custom Container in module pool program
Hello everyone,

I have created a custom control in my module pool screen. Now I want to s

radio button reamains checked
Hello i'm trying to keep the state off my radio buttons so it shows which ones where clicked after t

Need a fuction to count entries in a field
Hi
I need a fuction to count how many times a email address is entered in to a field.

I ma

problem with query error
First Thanks to those who helped me on my previous posts, and the following code i'm using is not mi

I have a parse error in this query help..
Code: $query1="INSERT INTO `rating` (`item_name`, `rating`, `ip_address`, `date_rated`) VALUES

How to show more than 1 users with this code...
Hello,
i have a table that shows users only if I, as Administrator, want to be shown. But its sho

Using unserialize()
Hi there.

I have some data in my database that is serialized.

e.g.

a:2:{i:0

understanding functions and classes
Code: [Select]
class person {
var $name = "Jimmy Goe";

function get_nam

Help adding strtolower( to my in_array
strtolower i need to add it to this to work, iuno how.

Code: $moderators = array('Admin', 'ba

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