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