Regular Expression





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
Regex Topics
Introduction Introduction
Common Metacharacter Common Metacharacter's
Metacharacters Metacharacter's
Qualifiers Quantifier's
Word Boundry Word Boundry
Non-word Boundry Non-word Boundry
POSIX Character Classes POSIX-Character Classes
Feedback Feedback
Forums Ask Your Doubts
 




Regular Expression Meta-character Wild "."


Tutorials Regular-expression

Topic

What is regular expression Wild character "."?




Explanation

In regular expression, the meta-character Wild "." or a wild character that can represent a single character.

In the pattern {o.*l} specifies a string with "o" followed by "l" with zero or more characters in between. The possible matches can be like "ol", "oshdfghdl", "odsdfl" etc.

PHP Example:
    <?php
    $string = 'caaa';
    if (preg_match('/^(c.*t)/', $string))
     echo "Regex Pattern match";
    else
     echo "Regex Pattern unmatch";    
    ?>
Result:
     Pattern unmatch 

In the above example the pattern "^(c.*t)" specifies that the string should start with "c" with any character following and at the end with a "t".

Perl Example:
    #! C:\programfiles\perl\bin\perl
    print "content-type: text/html\n\n";
    $name= "first name";
    if ($name =~ m/fi(.*)me/) 
      {print "The name format matched!";} 
    else 
      {print "The name format not matched!";}
Result:
    The name format matched!

In the above example's pattern ".*" represents the characters "rst na" and the rest of the characters are specified in the pattern.




A Note

Simple Regex Regular Expression Tutorial Online. We welcome your Valuable feedbacks or suggestions. This is a copyright content.


Other Links

web hosting