Skip to content

Feature: autolink_phone numbers #18

Open
@timbunch

Description

@timbunch

First off, thank you so much for this! I wanted to drop a note in here to see if you thought it would be quickly doable to extend this to also replace phone numbers. I'm currently doing this with my own simple regex and preg_replace. Would be so cool to have it in here as well!

My second rate PHP:

function autolink_phone($text) { $text = preg_replace("/\d?(\s?|-?|\+?|\.?)((\(\d{1,4}\))|(\d{1,3})|\s?)(\s?|-?|\.?)((\(\d{1,3}\))|(\d{1,3})|\s?)(\s?|-?|\.?)((\(\d{1,3}\))|(\d{1,3})|\s?)(\s?|-?|\.?)\d{3}(-|\.|\s)\d{4}/i", "<a href=\"tel:$0\" target='_blank'>$0</a>", $text); return ($text); }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions