skip to Main Content

replace part of string in value of json – Javascript

i want to replace 11111 to <, and 22222 to > in json My code: var json_A = { "question1": { "type": "string", "title": "11111img src=`https://i.imgur.com/RQpTQBw.png`22222", "enum": ["Adrian", "Attams", "Adrienne"], "requested": false }, "question2": { "type": "string", "title": "11111img src=`https://i.imgur.com/SHB02L8.png`22222",…

VIEW QUESTION

strrchr strtok php not working (extract everything after id=

been on this for 2 hours now ... $string = "https://www.example.com/?id=fsdf29512590125Agajgenaemganheji"; $end = strrchr($string, 'id='); // should return "fsdf29512590125Agajgenaemganheji" echo $end; only returns "i" these work but not in larger url $s = "https://www.example.com/?id=fsdf29512590125Agajgenaemganheji"; $firstPart = strtok( $s, 'id=' );…

VIEW QUESTION

How to exclude image extension from string place in PHP

I want to replace all the string values from example.com to sample.com excluding the image extension .png, .jpeg, .jpg etc. $body = ' www.example.com, example.com, example.com/hello.html, example.com/logo.png, example.com/yourbaby.php , example.com/newimage.jpg, www.example.com/newimage.jpg'; //values $oldomain = ['example.com','www.']; $newdomain= ['sample.com', '']; $excludeextension =…

VIEW QUESTION

Replace all domain including subdomain name using PHP with Regex

I am using preg_replace or str_replace in PHP to replace all the domain name including www $string = ' https://example.com, https://www.example.com, https://subdomain.example.com '; $olddomain= "example.com"; $newdomain = "stackoverflow.com"; $output = str_replace($olddomain, $newdomain, $string); $output = preg_replace('#(www[.])?[.]' . $olddomain. '#', $newdomain,…

VIEW QUESTION
Back To Top
Search