Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

PHP regular expressions


mrdj204's Avatar
Member
0 0

»(random numbers letters and spaces here)</span>

How would i search for that using regex?

I tried (»[.]+<\/span>) but that didn't work.

Help please.

[edit]

I got it.

correct syntax = (» [a-zA-Z0-9 ]+)

[/edit]


mido's Avatar
Member
0 0

Or you can simply try :

$string = &quot;&lt;span&gt;Text inside span...&lt;/span&gt;&quot;;

if (ereg(&quot;&lt;span&gt;(.*)&lt;/span&gt;&quot;, $string, $matches))
echo $matches[1];

else
echo &quot;Matches not found.&quot;;
?&gt;