Jump to content

Recommended Posts

I have over 2600 rows of text I need to loop through and add a title attribute in the link from the exisiting linked text to meet ADA compliance. For example:

 

Input string

Jack and Jill went up the hill to have a little fun,
but stupid Jill forgot <a href="
http://www.plannedparenthood.org/health-topics/birth-control/birth-control-pill-4228.htm">the pill</a>
and now they have a son!

 

Output string

Jack and Jill went up the hill to have a little fun,
but stupid Jill forgot <a
title="the pill" href="http://www.plannedparenthood.org/health-topics/birth-control/birth-control-pill-4228.htm">the pill</a>
and now they have a son!

 

Does anyone know how I can use preg_match_all and str_replace or anything else to accomplish this?

 

Thanks!!!

Link to comment
https://forums.phpfreaks.com/topic/280237-need-to-add-title-in-links-for-ada/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.