[haXe] haXe regexp and subexpressions

Michael Pliskin pl at tepkom.ru
Thu Apr 5 16:46:16 CEST 2007


Hello Nicolas,

  Hmm, going on with research...

  static var text           = ~/[^\x0A\x0D]/;
  static var quoted_pair    = ~/a$text/;

  trace(quoted_pair.match("ab"));

  results in false... As far as I understand, text allows any
  character except for newline, and quoted_pair should just allow any
  2-char string s with s[0] == 'a' and s[1] not a newline. Anything
  wrong?

MP> Hmm it works!! Thanks a lot. But I never could think of syntax sugar
MP> supporting that - it somehow does a name resolution... How does it
MP> work? I.e. what about

MP> function f1() {
MP>   var text = ~/[^\x0A\0xD]/;
MP> }

MP> function f2() {
MP>   var r2 = ~/\\$text/;
MP> }

MP> will it work? How does it resolve '$'-variables?

MP> -- 
MP> Best regards,
MP>  Michael                            mailto:pl at tepkom.ru





-- 
Best regards,
 Michael                            mailto:pl at tepkom.ru




More information about the Haxe mailing list