php - Why isn't my simple regex working? -


i have list of steps, , being echo'd view li items in ol.

so, need remove leading numbers (that ol { list-style: decimal }.

here example array member

  1. combine 1 tbs oil...

i tried regex

/^\d+\.\s*/ 

however, didn't remove 1. in example above

but, when remove start of line anchor (^), works.

here complete code.

foreach($method &$step) {      $step = trim(preg_replace('/^\d+\.\s*/', '', $step));     var_dump($step); // quoted above } 

what doing wrong?

thanks!

update

sorry guys, here var_dump() of 1 of lines..

string(43) "4. remove heat , cover keep warm." 

to me, doesn't there before digit.

is there whitespace before digit?

try

/^\s*\d+\.\s*/ 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -