Regex.hx 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Copyright (C)2005-2012 Haxe Foundation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  20. * DEALINGS IN THE SOFTWARE.
  21. */
  22. package cs.system.text.regularExpressions;
  23. import cs.NativeArray;
  24. @:native('System.Text.RegularExpressions.Regex') extern class Regex
  25. {
  26. function new(pattern:String, options:RegexOptions):Void;
  27. function Match(input:String):Match;
  28. function Split(input:String):NativeArray<String>;
  29. function Replace(input:String, replacement:String):String;
  30. }
  31. @:native("System.Text.RegularExpressions.RegexOptions") extern enum RegexOptions
  32. {
  33. None;
  34. IgnoreCase;
  35. Multiline;
  36. ExplicitCapture;
  37. Compiled;
  38. Singleline;
  39. IgnorePatternWhitespace;
  40. RightToLeft;
  41. ECMAScript;
  42. CultureInvariant;
  43. }
  44. @:native("System.Text.RegularExpressions.Capture") extern class Capture
  45. {
  46. var Index(default, null):Int;
  47. var Length(default, null):Int;
  48. var Value(default, null):String;
  49. }
  50. @:native("System.Text.RegularExpressions.Group") extern class Group extends Capture
  51. {
  52. var Success(default, null):Bool;
  53. }
  54. @:native("System.Text.RegularExpressions.Match") extern class Match extends Group
  55. {
  56. var Captures(default, null):CaptureCollection;
  57. var Groups(default, null):GroupCollection;
  58. }
  59. @:native("System.Text.RegularExpressions.CaptureCollection") extern class CaptureCollection implements ArrayAccess<Capture>
  60. {
  61. var Count(default, null):Int;
  62. }
  63. @:native("System.Text.RegularExpressions.GroupCollection") extern class GroupCollection implements ArrayAccess<Group>
  64. {
  65. var Count(default, null):Int;
  66. }