Regex.hx 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 java.util.regex;
  23. import java.NativeArray;
  24. extern class Pattern
  25. {
  26. static function compile(regex:String, flags:Int):Pattern;
  27. function matcher(input:String):Matcher;
  28. function split(input:String):NativeArray<String>;
  29. static var CANON_EQ(default, null):Int;
  30. static var CASE_INSENSITIVE(default, null):Int;
  31. static var COMMENTS(default, null):Int;
  32. static var DOTALL(default, null):Int;
  33. static var MULTILINE(default, null):Int;
  34. static var UNICODE_CASE(default, null):Int;
  35. static var UNIX_LINES (default, null):Int;
  36. }
  37. extern interface MatchResult
  38. {
  39. @:overload(function(group:Int):Int {})
  40. function end():Int;
  41. @:overload(function():String {})
  42. function group(group:Int):String;
  43. function groupCount():Int;
  44. @:overload(function(group:Int):Int {})
  45. function start():Int;
  46. }
  47. extern class Matcher implements MatchResult
  48. {
  49. function reset(input:String):Matcher;
  50. @:overload(function(group:Int):Int {})
  51. function end():Int;
  52. @:overload(function():String {})
  53. function group(group:Int):String;
  54. function groupCount():Int;
  55. @:overload(function(group:Int):Int {})
  56. function start():Int;
  57. @:overload(function(startPos:Int):Bool{})
  58. function find():Bool;
  59. function replaceAll(replacement:String):String;
  60. function replaceFirst(replacement:String):String;
  61. function pattern():Pattern;
  62. }