You are here

function regex_field_validation_help in RegEx Field Validation 7

Same name and namespace in other branches
  1. 8 regex_field_validation.module \regex_field_validation_help()
  2. 2.0.x regex_field_validation.module \regex_field_validation_help()
  3. 1.0.x regex_field_validation.module \regex_field_validation_help()

Implements hook_help().

File

./regex_field_validation.module, line 122
RegEx Field Validation module file.

Code

function regex_field_validation_help($path, $arg) {
  if ($path == 'admin/help#regex_field_validation') {
    $output = '';
    $output .= '<h3>' . t('About') . '</h3>';
    $output .= '<p>' . t('This module provides an extra validation option for text fields') . '</p>';
    $output .= '<p>' . t('It uses the power of regular expressions to validate the content from fields') . '</p>';
    $output .= '<h4>' . t('How to use it?') . '</h4>';
    $output .= '<ul>';
    $output .= '<li>' . t('Go to Manage Fields on any Content type') . '</li>';
    $output .= '<li>' . t('Edit any text field settings') . '</li>';
    $output .= '<li>' . t('Locate the RegEx Field Validation box that should be available in the settings form') . '</li>';
    $output .= '<li>' . t('Check the Validate field with RegEx option to activate the Regular Expression and Error message fields') . '</li>';
    $output .= '<li>' . t('Type in the regular expression that you want the field value to be matched against') . '</li>';
    $output .= '<li>' . t('Type in the error message that you want to be displayed when the field value does not validate') . '</li>';
    $output .= '</ul>';
    $output .= '<h4>' . t('Examples of regular expressions that can be used') . '</h4>';
    $output .= '<ul>';
    $output .= '<li>' . '<code>' . '\\^\\d.\\d+\\Z\\' . '</code >&nbsp;-&nbsp;' . '<b>' . t('Decimal followed by dot and unlimited decimals (1.12, 1.55, etc.') . '</b></li>';
    $output .= '<li>' . '<code>' . '\\^[^<\\x09]{0,100}\\Z\\' . '</code>&nbsp;-&nbsp;' . '<b>' . t('Text containing between 0 and 100 characters.') . '</b></li>';
    $output .= '<li>' . '<code>' . '\\^[AaBb]\\Z\\' . '</code >&nbsp;-&nbsp;' . '<b>' . t('1 character either A, a, B or b.') . '</b></li>';
    $output .= '<li>' . '<code>' . '\\^(http|https):\\/\\/.{2,80}\\Z\\' . '</code>&nbsp;-&nbsp;' . '<b>' . t('URL starting with “http” or “https” and contains between 2 and 80 characters.') . '</b></li>';
    $output .= '<li>' . '<code>' . '\\^.{2,40}\\@.{2,50}\\..{2,5}\\Z\\' . '</code >&nbsp;-&nbsp;' . '<b>' . t('Email address containing between 2 and 40 characters before the “@”, then between 2 and 50 characters as the domain name and between 2 and 5 as the top level domain') . '</b></li>';
    $output .= '<li>' . '<code>' . '\\^(0[1-9]|1[0-2])\\Z\\' . '</code>&nbsp;-&nbsp;' . '<b>' . t('2 digits that could represent the day of the month (01-31)') . '</b></li>';
    $output .= '<li>' . '<code>' . '\\^(19|20|21)[0-9]{2}\\Z\\' . '</code >&nbsp;-&nbsp;' . '<b>' . t('4 digits that could represent the year (1900-2199)') . '</b></li>';
    $output .= '<li>' . '<code>' . '\\^(ABC|DEF|GHI|JKL|MNO|PQR|STU|VWX)?\\Z\\' . '</code>&nbsp;-&nbsp;' . '<b>' . t('Accept a tree letter string that can be found in that list') . '</b></li>';
    $output .= '<li>' . '<code>' . '\\^([0-9]+(\\.[0-9]{2})?)?\\Z\\' . '</code >&nbsp;-&nbsp;' . '<b>' . t('Numeric with "." as decimal separator (29.99)') . '</b></li>';
    $output .= '<li>' . '<code>' . '\\^[0-9.]{1,8}\\Z<\\' . '</code>&nbsp;-&nbsp;' . '<b>' . t('Numerical value between 1 and 8 digits.') . '</b></li>';
    $output .= '<li>' . '<code>' . '\\^[^<\\x09\\x0a\\x0d]{0,10}\\Z\\' . '</code >&nbsp;-&nbsp;' . '<b>' . t('Single line between 0 and 10 characters that should not contain HTML markup') . '</b></li>';
    $output .= '<li>' . '<code>' . '\\^[^<]{0,100}\\Z\\' . '</code>&nbsp;-&nbsp;' . '<b>' . t('Multiple lines between 0 and 100 characters that should not contain HTML markup') . '</b></li>';
    $output .= '<li>' . '<code>' . '\\^[^<\\x09\\x0a\\x0d]{0,1000}\\Z\\' . '</code >&nbsp;-&nbsp;' . '<b>' . t('Text containing between 0 and 1000 letters, numbers and spaces') . '</b></li>';
    $output .= '</ul>';
    return $output;
  }
}