Try using a positive lookahead assertion:

while ( /a(?=a)/g){}

Let me know if it works.  ;-)

----- Original Message -----
From: "Bram Heyns" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, December 19, 2001 2:37 PM
Subject: global matching


I have a rather simple question, but I can't figure it out!
For example if I have a string like "aaaa" and I want to match every "aa" in
there, how should I do this?
So I want a match on position 0-1,1-2,2-3.
If I use if(/aa/g){} statement, it only finds one, and if I use
while(/aa/g){} then it only finds 2 ! How can I find all of them, even if
there are more a's?
Who can help me out?

You can contact me on : [EMAIL PROTECTED]

Thanks,
Bram.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to