Apply for Zend Framework Certification Training

Corephp






                              Preg Match
Enter Your Yousername:

"; $f=preg_match("/^[a-zA-Z0-9_.-]+@[a-zA-Z0-9_]+\.[a-zA-Z]{2,5}$/",$a); if($f) { echo "Pattern Match"; } else { echo "Pattern Doesnot match"; } } ?> Preg Match All bold textclick me"; preg_match_all("/(<([\w]+)[^>]*>)(.*?)(<\/\\2>)/", $html, $matches, PREG_SET_ORDER); ?> John Poul
Title: PHP Guru"; preg_match_all ("/(.*)<\/b>/U", $userinfo, $pat_array); print $pat_array[0][0]."
".$pat_array[0][1]."\n"; print_r($pat_array); preg_match_all('/.+/U', 'navi', $matches); print_r($matches); preg_match_all('/pop/', "regex in php hello pop jackpop",$all); print_r($all); ?> Preg Grep

Enter String:

Preg Replace

Input :
Pattern:
Replaced by:

Preg Replace Callback FILTER_VALIDATE_EMAIL "; if (filter_var($email_b, FILTER_VALIDATE_EMAIL)) { echo "This (email_b) email address is considered valid."; } else { echo "This (email_b) email address is Not considered valid."; } ?> FILTER_VALIDATE_IP FILTER_VALIDATE_URL

Accept only Alphabets ctype_alpha

Output only Alphanumeric ctype_alnum

Accept only Digits ctype_digit

Delimiters When using the PCRE functions, it is required that the pattern is enclosed by delimiters. A delimiter can be any non-alphanumeric, non-backslash, non-whitespace character. Often used delimiters are forward slashes (/), hash signs (#) and tildes (~). The following are all examples of valid delimited patterns.

Remove White Space and Spcel Chracter

"; for ($x = 0; $x < $strLen; $x++) { $singleChar = substr($oldString, $x, 1); echo $singleChar; //echo "
"; if (ctype_alnum($singleChar)) { $newString = $newString . $singleChar; } } echo "
"; echo $newString; ?>

< Call data randamly from array api data to accesss element retrieved in json_decode format in php >



Ask a question



  • Question:
    {{questionlistdata.blog_question_description}}
    • Answer:
      {{answer.blog_answer_description  }}
    Replay to Question


Back to Top