faqts : Computers : Programming : Languages : PHP : Common Problems : Regular Expressions

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

2 of 3 people (67%) answered Yes
Recently 2 of 3 people (67%) answered Yes

Entry

I have urls like "c(some numbers)s.html". How can I find out the number bewteen c and s.html?

Feb 14th, 2002 09:59
Ben Udall, Arman Galstyan,


// A sample url
$url = "c1234s.html";
ereg("c([0-9]+)s\\.html", $url, $m);
$num = $m[1];
// $num now contains the number between the c and s.html