You are here

function follow_build_url_regex in Follow 7.2

Same name and namespace in other branches
  1. 5 follow.module \follow_build_url_regex()
  2. 7 follow.module \follow_build_url_regex()

Build a regex to validate the url based on a known service url.

1 call to follow_build_url_regex()
follow_url_validate in ./follow.inc
Validates the url field to verify it's actually a url.

File

./follow.inc, line 232
Follow module API and helper functions.

Code

function follow_build_url_regex($network_info) {
  if (!empty($network_info['domain'])) {

    // An external link.
    return '@^https?://([a-z0-9\\-_.]+\\.|)' . str_replace('.', '\\.', $network_info['domain']) . '/@i';
  }

  // An internal link should not have ':'.
  return '@^[^:]+$@';
}