Regex.hx 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package system.text.regularExpressions;
  2. import cs.NativeArray;
  3. @:native('System.Text.RegularExpressions.Regex') extern class Regex
  4. {
  5. function new(pattern:String, options:RegexOptions):Void;
  6. function Match(input:String):Match;
  7. function Split(input:String):NativeArray<String>;
  8. function Replace(input:String, replacement:String):String;
  9. }
  10. @:native("System.Text.RegularExpressions.RegexOptions") extern enum RegexOptions
  11. {
  12. None;
  13. IgnoreCase;
  14. Multiline;
  15. ExplicitCapture;
  16. Compiled;
  17. Singleline;
  18. IgnorePatternWhitespace;
  19. RightToLeft;
  20. ECMAScript;
  21. CultureInvariant;
  22. }
  23. @:native("System.Text.RegularExpressions.Capture") extern class Capture
  24. {
  25. var Index(default, null):Int;
  26. var Length(default, null):Int;
  27. var Value(default, null):String;
  28. }
  29. @:native("System.Text.RegularExpressions.Group") extern class Group extends Capture
  30. {
  31. var Success(default, null):Bool;
  32. }
  33. @:native("System.Text.RegularExpressions.Match") extern class Match extends Group
  34. {
  35. var Captures(default, null):CaptureCollection;
  36. var Groups(default, null):GroupCollection;
  37. }
  38. @:native("System.Text.RegularExpressions.CaptureCollection") extern class CaptureCollection implements ArrayAccess<Capture>
  39. {
  40. var Count(default, null):Int;
  41. }
  42. @:native("System.Text.RegularExpressions.GroupCollection") extern class GroupCollection implements ArrayAccess<Group>
  43. {
  44. var Count(default, null):Int;
  45. }