hi folks...
Variable contains a string which includes html tags...etc...
i need to get booayt28.05.2008uze2u from the variable string...
am trying like this...but its not showing any o/p
$string = "<tr><td bgcolor='#E5ECF9' valign='top'>28.05.2008<BR>Bodø</td><td bgcolor='#E5ECF9' valign='top'><a href='#' onClick='OpenHotel(32);'>Uzel Hotel 2 uker med frokost </a></td><td bgcolor='#E5ECF9' valign='top'><div align='right'>NOK 3 890</div></td><td bgcolor='#E5ECF9' valign='top'><div align='right'>7<td bgcolor='#E5ECF9' valign='top' nowrap><div align='right'><a href='#' onClick="PostPageT('booayt28.05.2008uze2u','false' );"><b><font color=#ff9900>Bestill nå</font></b> »</a>";
$pos13 = strpos($row,"<a href='#' onClick=".'"'."PostPageT('");
//echo $pos13;
$buff = substr($row,$pos13+11);
$pos14 = strpos($buff,"',','false');".'"'."><b>");
$Value = substr($row,$pos13+11,$pos14);
echo "Value : ".$Value;
substring
Moderator: General Moderators
Re: substring
You need a regexp:
Code: Select all
preg_match('/onClick="PostPageT\(\s*\'(.*)\'\s*,\s*\'false\'\s*\);"/', $string, $matches);
print_r($matches);
There are 10 types of people in this world, those who understand binary and those who don't
-
Swathimaddipatla
- Forum Newbie
- Posts: 9
- Joined: Fri May 09, 2008 7:08 am
Re: substring
actually problem occurs in the string assigned to variable...
string assigned to the variable consists double quote("PostPageT('booayt28.05.2008uze2u','false'); ") inside a sting.....in normal cases i can make it as single quote..but the thing is i cant modify the string.am getting this string as response from some other....
with out changing string in a variable..i need to out put booayt28.05.2008uze2u...
i think u have understood my problem....
pls..help me
string assigned to the variable consists double quote("PostPageT('booayt28.05.2008uze2u','false'); ") inside a sting.....in normal cases i can make it as single quote..but the thing is i cant modify the string.am getting this string as response from some other....
with out changing string in a variable..i need to out put booayt28.05.2008uze2u...
i think u have understood my problem....
pls..help me
Re: substring
Code: Select all
$string = "<tr><td bgcolor='#E5ECF9' valign='top'>28.05.2008<BR>Bodø</td><td bgcolor='#E5ECF9' valign='top'><a href='#' onClick='OpenHotel(32);'>Uzel Hotel 2 uker med frokost </a></td><td bgcolor='#E5ECF9' valign='top'><div align='right'>NOK 3 890</div></td><td bgcolor='#E5ECF9' valign='top'><div align='right'>7<td bgcolor='#E5ECF9' valign='top' nowrap><div align='right'><a href='#' onClick=\"PostPageT('booayt28.05.2008uze2u','false');\"><b><font color=#ff9900>Bestill nå</font></b> »</a>";
preg_match('/onClick=[\'"]PostPageT\(\s*[\'"](.*)[\'"]\s*,\s*[\'"]false[\'"]\s*\);[\'"]/', $string, $matches);
print_r($matches);
There are 10 types of people in this world, those who understand binary and those who don't