Solved

Regular Expression - only the first result

Posted on 2014-09-27
1
159 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
1 Comment
 
LVL 58

Accepted Solution

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

Open in new window

0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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 is …
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

821 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