/jEdit/branches/4.4.x/modes/regex.xml

# · XML · 121 lines · 73 code · 14 blank · 34 comment · 0 complexity · 6b4a20f9b99bef07aa2736f36f024344 MD5 · raw file

  1. <?xml version="1.0"?>
  2. <!DOCTYPE MODE SYSTEM 'xmode.dtd'>
  3. <!-- Regular Expression mode, by Kevin Hunter -->
  4. <!-- Currently implemented artifacts:
  5. ***** Classes
  6. [...] - user-defined character classes
  7. \d - Numerical characters (eq. [0-9])
  8. \D - Non-numerical characters (eq. [^0-9])
  9. \w - Alphanumeric characters and underscore (eq. [A-Za-z0-9_])
  10. \W - Opposite of \w (eq. [^A-Za-z0-9_])
  11. \s - Whitespace characters (ex. space, tab, formfeed, newline)
  12. \S - Non-whitespace characters
  13. \b - Word-break character
  14. . - Any character, generally not including a newline (\n)
  15. ***** Operators
  16. ^ - Match at beginning of string
  17. $ - Match at end of string
  18. ? - optionally match previous item token
  19. * - Match previous token 0 or more times.
  20. + - Match previous token 1 or more times.
  21. | - Logical OR, allowing the previous token or next token to match
  22. {m} - Match previous token exactly m times.
  23. {m,} - Match previous token at least m times
  24. {m,n} - Match previous token between m and n times, inclusive.
  25. ***** Functions
  26. [^...] - negate user-defined character classes
  27. (...) - Backreference - effectively save the matched part for later use
  28. (?:...) - Group - Don't save, just mark the section of the pattern as a group
  29. (?=...) - zero-width positive lookahead assertion
  30. (?!...) - zero-width negative lookahead assertion
  31. (?<=...) - zero-width positive lookbehind assertion
  32. (?<!...) - zero-width negative lookbehind assertion
  33. -->
  34. <MODE>
  35. <RULES IGNORE_CASE='FALSE' HIGHLIGHT_DIGITS='TRUE' SET='FORCED_NUMBER'>
  36. <SEQ TYPE='OPERATOR'>,</SEQ>
  37. </RULES>
  38. <RULES IGNORE_CASE='FALSE' HIGHLIGHT_DIGITS='TRUE'>
  39. <SEQ TYPE='NULL'>\\</SEQ>
  40. <SEQ TYPE='NULL'>\(</SEQ>
  41. <SEQ TYPE='NULL'>\)</SEQ>
  42. <SEQ TYPE='NULL'>\[</SEQ>
  43. <SEQ TYPE='NULL'>\]</SEQ>
  44. <SEQ TYPE='NULL'>\{</SEQ>
  45. <SEQ TYPE='NULL'>\}</SEQ>
  46. <SEQ TYPE='NULL'>\^</SEQ>
  47. <SEQ TYPE='NULL'>\$</SEQ>
  48. <SEQ TYPE='NULL'>\?</SEQ>
  49. <SEQ TYPE='NULL'>\+</SEQ>
  50. <SEQ TYPE='NULL'>\*</SEQ>
  51. <SEQ TYPE='NULL'>\.</SEQ>
  52. <SEQ TYPE='NULL'>\|</SEQ>
  53. <SEQ TYPE='OPERATOR'>^</SEQ>
  54. <SEQ TYPE='OPERATOR'>$</SEQ>
  55. <SEQ TYPE='OPERATOR'>?</SEQ>
  56. <SEQ TYPE='OPERATOR'>*</SEQ>
  57. <SEQ TYPE='OPERATOR'>+</SEQ>
  58. <SEQ TYPE='OPERATOR'>|</SEQ>
  59. <SEQ TYPE='KEYWORD1'>\b</SEQ>
  60. <SEQ TYPE='DIGIT'>\d</SEQ>
  61. <SEQ TYPE='LITERAL2'>\D</SEQ>
  62. <SEQ TYPE='KEYWORD3'>\w</SEQ>
  63. <SEQ TYPE='KEYWORD3'>.</SEQ>
  64. <SEQ TYPE='LITERAL3'>\W</SEQ>
  65. <SEQ TYPE='KEYWORD4'>\s</SEQ>
  66. <SEQ TYPE='LITERAL4'>\S</SEQ>
  67. <SPAN TYPE='FUNCTION' DELEGATE='MAIN'>
  68. <BEGIN>[^</BEGIN> <!-- user-defined negative character class -->
  69. <END>]</END>
  70. </SPAN>
  71. <SPAN TYPE='FUNCTION' DELEGATE='MAIN'>
  72. <BEGIN>(?=</BEGIN> <!-- zero-width positive lookahead assertion -->
  73. <END>)</END>
  74. </SPAN>
  75. <SPAN TYPE='FUNCTION' DELEGATE='MAIN'>
  76. <BEGIN>(?!</BEGIN> <!-- zero-width negative lookahead assertion -->
  77. <END>)</END>
  78. </SPAN>
  79. <SPAN TYPE='FUNCTION' DELEGATE='MAIN'>
  80. <BEGIN><![CDATA[(?<=]]></BEGIN> <!-- zero-width positive lookbehind assertion -->
  81. <END>)</END>
  82. </SPAN>
  83. <SPAN TYPE='FUNCTION' DELEGATE='MAIN'>
  84. <BEGIN><![CDATA[(?<!]]></BEGIN> <!-- zero-width negative lookbehind assertion -->
  85. <END>)</END>
  86. </SPAN>
  87. <SPAN TYPE='FUNCTION' DELEGATE='MAIN'>
  88. <BEGIN>(?:</BEGIN> <!-- unsaved group -->
  89. <END>)</END>
  90. </SPAN>
  91. <SPAN TYPE='OPERATOR' DELEGATE='FORCED_NUMBER'>
  92. <BEGIN>{</BEGIN>
  93. <END>}</END>
  94. </SPAN>
  95. <SPAN TYPE='OPERATOR' DELEGATE='MAIN'>
  96. <BEGIN>[</BEGIN> <!-- user-defined character class -->
  97. <END>]</END>
  98. </SPAN>
  99. <SPAN TYPE='FUNCTION' DELEGATE='MAIN'>
  100. <BEGIN>(</BEGIN> <!-- saved group (backreference) -->
  101. <END>)</END>
  102. </SPAN>
  103. </RULES>
  104. </MODE>