top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

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

+2 votes
61 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 Google+ Share Button LinkedIn Share Button Multiple Social 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
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...