Reputation: 41
I want to delete the other texts before the first <tr class="vcard agent">
in a document.
Note: There are multiple <tr class="vcard agent">
s in the document.
Upvotes: 3
Views: 2100
Reputation: 1254
$answer = strstr($oriString,'<tr class="vcard agent">');
See strstr
Docs.
Upvotes: 5
Reputation: 23065
Something like this might work:
preg_replace('/.*?<tr class="vcard agent">/', '<tr class="vcard agent">', $string);
Edit: Pradeep's answer looks like it is the best one.
Upvotes: 4
Reputation: 7715
$first = strpos($html, '<tr class="vcard agent">');
$result = substr($html, $first);
Upvotes: 1