Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > regular expressions and multiple match

Reply
Thread Tools

regular expressions and multiple match

 
 
ast
Guest
Posts: n/a
 
      03-11-2011
- sent again -

hi,

let us search a.+b in string abcabcabc

var reg = /a.+b/g;
var tab = reg.exec("abcabcabc");

document.write(tab[0]);

there are 2 possible matchs:

abcab
abcabcab

javascript choose the second one. Why not. But what is the rule ?
Does javascript always provide the longest possible match ?

If i want abcab, is there something to do ?

thx
 
Reply With Quote
 
 
 
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      03-11-2011
ast wrote:

> - sent again -


Why?


PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)
 
Reply With Quote
 
 
 
 
ast
Guest
Posts: n/a
 
      03-11-2011

"Thomas 'PointedEars' Lahn" <> a écrit dans le message de
news:...
> ast wrote:
>
>> - sent again -

>
> Why?
>


i beleaved that the first one didnt arrived.
it arrived finally, but after 2 ou 3 minutes

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
regular expressions and multiple match ast Javascript 4 03-11-2011 04:31 PM
Regular expressions (multiple match problem) mikko.n C Programming 5 04-02-2008 10:14 PM
How to match literal backslashes read from a text file using regular expressions? cricfan@gmail.com Python 2 07-12-2005 11:53 PM
Regular expressions and parenthesis in match text Carl Cunningham Perl Misc 2 09-15-2003 11:02 AM
Add custom regular expressions to the validation list of available expressions Jay Douglas ASP .Net 0 08-15-2003 10:19 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57