find whitespace in hyperlinks with php and fix them -


i have hyperlinks entered users have been justified. has created following scenario in html:

<a href="http://  www.  web site  link  .com  ">website link bro  ken  </a> 

how can use php fix on page load or in script run on database achieve this:

<a href="http://www.websitelink.com">website link bro   ken</a> (the link text guess impossible fix without checkning if parts of words fit - long link works, on screen justification have pass. 

please bear in mind these occurances within large bodies of text. searching spaces begin finding each link , 'repairing' it.

 function replacespaces( $in ) {  return preg_replace( "/ /", "", $in ); }   $link = preg_replace( "/href=\"[^\"]+\"/ie", " replacespaces( '\$0' )", $link ); 

edited - thx comments - mistake


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -