Regular Expression

1. ([a-z]+) this expression will count a word from small a to small z. Such as according to this code which is given below.
<?php
    $preg = "aAAAA Bbbbb bbbbb bbbbbb";

    echo preg_replace("([a-z]+)", "1", $preg);
?>
You will get this output '1AAAA B1 1 1'.



2. ([a-z]) this expression will count a single character from small a to small z. Such as according to this code which is given below.
<?php
    $preg = "aAAAA Bbbbb bbbbb bbbbbb";

    echo preg_replace("([a-z])", "1", $preg);
?>
You will get this output '1AAAA B1111 11111 111111'.

Comments

Popular posts from this blog

WP register_post_type() with custom CMB2 meta box

Git post receive setup at server for git push to the production from local machine