Javascript Regular Expressions - jQuery highlightTextarea

Hi E's, I'm developing a kind of html editor in a textarea (WYSIWYG), and adapted a plugin for highlight, this one: jQuery highlightTextArea, and I need help to create some regular expressions for javascript, like this: example from plugin website.
I can Insert two tags in my WYSIWYG, one for insert image, and other to insert youtube videos:
<img src="the_image.jpg" style="display: block; margin-left: 0px; margin-right: auto; padding: 15px 15px 15px 15px;" class="img-responsive" alt="the alt tag" width="640" height="480">

Open in new window

<div class="video-container"><iframe src="http://www.youtube.com/embed/m-ijfwr4SzI" frameborder="0" width="560" height="315"></iframe></div>

Open in new window

To get the tags highlight, I need a regular expression for highlight that two lines (image and video).
How I do that?

The best regards, JC
LVL 4
Pedro ChagasWebmasterAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
Why not just use the industry standard that millions of WordPress web sites have already debugged for us?  Have a look at TinyMCE.  It's amazingly easy to use.  You can have it configured and running in minutes.
0
Pedro ChagasWebmasterAuthor Commented:
Thank you @Ray.
Before I begin the adventure of construct my own editor, I explore lots of alternatives, and none of these html editors served for my very specific needs, for this reason I had to do my own editor, and the editor in order to complete and proceed with my project, I just need to know a part of the regular expressions.
I confess I did not know TinyMCE, sure it will be an excellent alternative for future projects.

~JC
0
Ray PaseurCommented:
There are basically two center-of-gravity textarea editors, TinyMCE and CKEditor.  You may also want to explore BBCode and the lightweight MarkDown syntax.  I think you might want to start with either of TinyMCE or CKEditor and build your editor from their platform.  Both are free and open source.

I'm not sure about the regular expression, so I'll sign off now -- suggest you leave this open a while and perhaps another expert can come along to help with that part.

Best regards, ~Ray
0
Dan CraciunIT ConsultantCommented:
This will match both lines:
<img src="the_image\.jpg".*?>|<div class="video-container".*?</div>

Open in new window

HTH,
Dan
0
Terry WoodsIT GuruCommented:
To allow for variable image names, I've adjusted Dan's pattern:
<img src="[^"]*".*?>|<div class="video-container".*?</div>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Regular Expressions

From novice to tech pro — start learning today.