You are here

function feeds_tamper_find_replace_regex_validate in Feeds Tamper 7

Same name and namespace in other branches
  1. 6 plugins/find_replace_regex.inc \feeds_tamper_find_replace_regex_validate()
1 string reference to 'feeds_tamper_find_replace_regex_validate'
find_replace_regex.inc in plugins/find_replace_regex.inc

File

plugins/find_replace_regex.inc, line 46

Code

function feeds_tamper_find_replace_regex_validate(&$settings) {

  // Test the regex.
  $test = @preg_replace($settings['find'], '', 'asdfsadf');
  if ($test === NULL) {
    form_set_error('settings][find', 'Invalid regular expression.');
  }
  $settings['limit'] = trim($settings['limit']);
  if (empty($settings['limit'])) {
    $settings['real_limit'] = -1;
  }
  else {
    $settings['real_limit'] = $settings['limit'];
  }
  if (!is_numeric($settings['real_limit'])) {
    form_set_error('settings][limit', 'Limit must be an integer.');
  }
}