Skip to main content
added 32 characters in body
Source Link

If your question pertains to display purposes only, it would be a lot easier to do something like this since regex would not be needed.

<?php
$s = 'http://www.amazon.com/Mindfulness-Be-mindful-Live-moment/dp/0857084445/ref=sr_1_1?s=books&ie=UTF8&qid=1443534574&sr=1-1&keywords=Mindfulness+Be+Mindful+Live+In+The+Moment';
?> <a href="<?php echo $s?>"> Whatever you want here</a>

Edit: I would have asked if it was for display only in the comments section, if I had 50 rep.

If your question pertains to display purposes only, it would be a lot easier to do something like this.

<?php
$s = 'http://www.amazon.com/Mindfulness-Be-mindful-Live-moment/dp/0857084445/ref=sr_1_1?s=books&ie=UTF8&qid=1443534574&sr=1-1&keywords=Mindfulness+Be+Mindful+Live+In+The+Moment';
?> <a href="<?php echo $s?>"> Whatever you want here</a>

If your question pertains to display purposes only, it would be a lot easier to do something like this since regex would not be needed.

<?php
$s = 'http://www.amazon.com/Mindfulness-Be-mindful-Live-moment/dp/0857084445/ref=sr_1_1?s=books&ie=UTF8&qid=1443534574&sr=1-1&keywords=Mindfulness+Be+Mindful+Live+In+The+Moment';
?> <a href="<?php echo $s?>"> Whatever you want here</a>

Edit: I would have asked if it was for display only in the comments section, if I had 50 rep.

Source Link

If your question pertains to display purposes only, it would be a lot easier to do something like this.

<?php
$s = 'http://www.amazon.com/Mindfulness-Be-mindful-Live-moment/dp/0857084445/ref=sr_1_1?s=books&ie=UTF8&qid=1443534574&sr=1-1&keywords=Mindfulness+Be+Mindful+Live+In+The+Moment';
?> <a href="<?php echo $s?>"> Whatever you want here</a>