Extract small piece from code-line with preg_match

Hi,

I need 'hfd' extracted from the code. but it isn't working correct..

Thanks!
$subject= '<!--START-Password-->hfd<!--Password-END-->';
preg_match('@(?:-->[^"]*?/)(<!-[^"]*)@', $subject, $matches);
$url = $matches[1];
echo $url;

Open in new window

peps03Asked:
Who is Participating?
 
ncooConnect With a Mentor Commented:
Use the following:
<?php
$subject= '<!--START-Password-->hfd<!--Password-END-->';
preg_match('@<!--START-Password-->([^<]*?)<!--Password-END-->@', $subject, $matches);
$url = $matches[1];
echo $url;

Open in new window

0
 
peps03Author Commented:
thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.