?
Solved

Regular Expression - only the first result

Posted on 2014-09-27
1
Medium Priority
?
172 Views
Last Modified: 2014-09-27
Hi E's, I have this code for select in textarea all the text between <b> and </b> html tags (the selection include the tags):
words: [{
            color: 'yellow',
            words: ['<b>[^"]*</b>']
        }, {

Open in new window

and the result is:the output of my codeThe problem is, when have in the same textarea more then one set of <b>...</b> html tags, the script will select the first <b> and the last </b>. For example, if I have this text in my textarea:
<b>something></b>bla bla bla<b>more bla</b>
, all text is selected.
What change I have to do in my regular expression '<b>[^"]*</b>', for just select the <b> and just the next </b> (not the last in textarea)?

The best regards, JC
0
Comment
Question by:Pedro Chagas
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 58

Accepted Solution

by:
Gary earned 2000 total points
ID: 40347656
<b>[^"]*?</b>

Open in new window

0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question