changing function wp_register

how can i change function in general-template.php without affecting this core file on this:

if ( ! is_user_logged_in() ) {
    if ( get_option('users_can_register') )
        $link = $before . '<a href="' . site_url('wp-login.php?action=register', 'login') . '">' . __('Register') . '</a>' . $after;

to this:

if ( ! is_user_logged_in() ) {
    if ( get_option('users_can_register') )
        $link = $before . '<a href="' . site_url('/profile') . '">' . __('Profile Page') . '</a>' . $after;

Solutions Collecting From Web of "changing function wp_register"

Use the following filter named register:

add_filter( 'register', 'wpse_96892_register_link' );

function wpse_96892_register_link( $link )
{
    if ( is_user_logged_in() )
        return $link;

    return str_replace(
        // search
        array (
            site_url('wp-login.php?action=register', 'login'),
            __('Register')
        ),
        // replacements
        array (
            site_url('/profile'),
            __('Profile Page')
        ),
        $link
    );
}