Why isn't my simple regex working?

DJDif007

New Member
I have a list of steps, and they are being \[code\]echo\[/code\]'d into the view as \[code\]li\[/code\] items in a \[code\]ol\[/code\].So, I need to remove leading numbers (that look like \[code\]ol { list-style: decimal }\[/code\].Here is an example array member\[quote\] [*]Combine 1 tbs oil... \[/quote\]I tried this regex\[code\]/^\d+\.\s*/\[/code\]However, it didn't remove the \[code\]1.\[/code\] in the example aboveBut, when I remove the start of line anchor (\[code\]^\[/code\]), it works.Here is the complete code.\[code\]foreach($method as &$step) { $step = trim(preg_replace('/^\d+\.\s*/', '', $step)); var_dump($step); // This is what I quoted above}\[/code\]What am I doing wrong?Thanks!UpdateSorry guys, here is a \[code\]var_dump()\[/code\] of one of the lines..\[code\]string(43) "4. Remove from heat and cover to keep warm."\[/code\]To me, it doesn't look there is anything before the digit.
 
Back
Top