Re: [flexcoders] RegExp multiple backreferences?

2007-11-27 Thread Adnan Doric
I think you should use g (global) flag in your regexp.

Adnan

joshuajnoble wrote:

 Can any RegEx genius :) tell me whether ActionScript 3 properly
 supports multiple backreferences? The code I'm trying to use is this:

 private var headerBackreference:RegExp = /H([123]).*?\/H\1/;
 private function init():void {
 var s:String = BODYH2Valid Chocolate/H2 H2Valid
 Vanilla/H2 H2Invalid HTML/H3/BODY;
 var a:Array = headerBackreference.exec(s) as Array;
 if(a != null) {
 for(var i:int = 0; ia.length; i++) {
 trace(a[i]);
 }
 }
 a = s.match(headerBackreference);
 if(a != null) {
 for(var i:int = 0; ia.length; i++) {
 trace(a[i]);
 }
 }
 }

 I'm just trying to determine whether in fact this should return both
 the chocolate and the vanilla, or whether the behavior I see,
 returning just chocolate, is accurate. Thanks,

 Josh

  



[flexcoders] RegExp multiple backreferences?

2007-11-26 Thread joshuajnoble
Can any RegEx genius :) tell me whether ActionScript 3 properly
supports multiple backreferences? The code I'm trying to use is this:

private var headerBackreference:RegExp = 
/H([123]).*?\/H\1/;
private function init():void {
var s:String = BODYH2Valid Chocolate/H2 
H2Valid
Vanilla/H2 H2Invalid HTML/H3/BODY;
var a:Array = headerBackreference.exec(s) as 
Array;
if(a != null) {
for(var i:int = 0; ia.length; i++) {
trace(a[i]);
}
}
a = s.match(headerBackreference);
if(a != null) {
for(var i:int = 0; ia.length; i++) {
trace(a[i]);
}
}
}


I'm just trying to determine whether in fact this should return both
the chocolate and the vanilla, or whether the behavior I see,
returning just chocolate, is accurate. Thanks,

Josh



Re: [flexcoders] RegExp multiple backreferences?

2007-11-26 Thread Adnan Doric
I think you should use g (global) flag in your regexp.

Adnan

joshuajnoble wrote:

 Can any RegEx genius :) tell me whether ActionScript 3 properly
 supports multiple backreferences? The code I'm trying to use is this:

 private var headerBackreference:RegExp = /H([123]).*?\/H\1/;
 private function init():void {
 var s:String = BODYH2Valid Chocolate/H2 H2Valid
 Vanilla/H2 H2Invalid HTML/H3/BODY;
 var a:Array = headerBackreference.exec(s) as Array;
 if(a != null) {
 for(var i:int = 0; ia.length; i++) {
 trace(a[i]);
 }
 }
 a = s.match(headerBackreference);
 if(a != null) {
 for(var i:int = 0; ia.length; i++) {
 trace(a[i]);
 }
 }
 }

 I'm just trying to determine whether in fact this should return both
 the chocolate and the vanilla, or whether the behavior I see,
 returning just chocolate, is accurate. Thanks,

 Josh