Howto replace hyphen with shy inside paragraph with preg_replace

209
August 07, 2017, at 4:20 PM

How to search and replace hyphens within paragraphs to &shy?

Tried (with awful result):

$s = '<h1>test-1</h1>
<p>multi-plication</p>';
$t = preg_replace('[<p>\-(.*?)</p>]','&shy;',$s);
die($t);

if possible, it should look for the hyphen to be surrounded by [a-z] on both sides.

UPDATE: This method is not recommended since it could affect unintentional hypens sucha as tag attributes with class-names etc.

Rent Charter Buses Company
READ ALSO
application/json all requests going to 403

application/json all requests going to 403

Through postman, I am posting data to specific URL like sitecom/read_request

236
Bad performance in the cURL call on the same server

Bad performance in the cURL call on the same server

Why just few concurrency can cause block when cURL call on the same server

210
What is the best online quiz exam system using only php and mysql?Supported on 000webhost? [on hold]

What is the best online quiz exam system using only php and mysql?Supported on 000webhost? [on hold]

Help to find out pleaseand give me the whole project source code

204
how to get next month&#39;s date and it&#39;s not related to current month date in MySQL

how to get next month's date and it's not related to current month date in MySQL

I have three columns in my table, future 3 months like fistdate(next month), secondate(+2 next month) and thirdate(+3 next month) which are DATE typesI want to save my dates as follows 09/09/2017, 09/10/2017 and 09/11/2017 and current month is 07/08/2017...

237