python (12.9k questions)
javascript (9.2k questions)
reactjs (4.7k questions)
java (4.2k questions)
java (4.2k questions)
c# (3.5k questions)
c# (3.5k questions)
html (3.3k questions)
Add leading zero to numeric strings containing decimal value if no leading number
I have about 200 lines in text file
values can be like
$array = ['.1','1.5','0.10','.8'....];
And I am looking specific regex pattern for replace .number like '.1' or '.8'
preg_replace('/\.(\d+)/','...
dodo
Votes: 0
Answers: 4
PHP : how to replace numbers in a string with the exact given value
i have 2 arrays and a string:
$attribute_ids = array(200,201);
$attribute_names = array("David","Rimma");
$string = "200 2006-2009 boy, 201 girl";
$string = str_replace($...
davidasor
Votes: 0
Answers: 1
Clean up a comma-separated list by regex
I want to clean up a tag list separated by comma to remove empty tags and extra spaces. I came up with
$str='first , second ,, third, ,fourth suffix';
echo preg_replace('#[,]{2,}#',',',preg_replace(...
Googlebot
Votes: 0
Answers: 2