I am trying to replace line numbers with dot(.) “123.” using regular expression. for example the line is,
123. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
Here i want to get rid off “123.” which is at the start of the line.
At the moment the code i have that replace any number and dot(.) in anywhere in the line but i want to get rid off numbers and dot(.) only at the start of the line.
Here is my code,
<?php
$pattern = '/[0-9. |0-9.](?:\d{0})/';
$replacement = ' ';
$try= preg_replace($pattern, $replacement, $line);
echo "\r\n" . html_entity_decode($try);
?>
I would appreciate if anyone can point me to the right direction. thanks
Try this code..
Result
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">Codepad.