Solved

Regular Expression - only the first result

Posted on 2014-09-27
1
167 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 500 total points
ID: 40347656
<b>[^"]*?</b>

Open in new window

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
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 how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

726 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