top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to extract sub-string ‘heat’ from a string ‘wheat’ using regular expression in PHP?

+2 votes
429 views
How to extract sub-string ‘heat’ from a string ‘wheat’ using regular expression in PHP?
posted Mar 25, 2014 by Mridul

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

We can use the preg_match() function with “/^$/” as the regular expression pattern.

Ex:
<?php preg_match("/^heat$/","wheat",$match); echo $match[1]; ?>

answer Mar 26, 2014 by Pavan P Naik
...