StyleEdit.SetKeywordStyle Method
| Explanation | Register the style and the keyword to be applied in the style number. | ||||||||||||
| Call format | StyleEdit1.SetKeywordStyle( styleNo, keywordsOrRegExp, mode, fgColor [, bgColor [, fontFace [, fontKind [, fontSize ] ] ] ] ) | ||||||||||||
| Return value | None | ||||||||||||
| Arguments | integer styleNo | The style number to register. The range that can be specified is from 0 to 8. | |||||||||||
| String keywordsOrRegExp | Specify a keyword list or regular expression. The keyword list is a character string in which keywords are separated by one of the characters "\ n", "\ r", "\ t", and a space. Up to 256 keywords can be registered. Since the condition is applied to the regular expression line by line, you cannot specify a style that spans multiple lines. | ||||||||||||
| integer mode | Specifies the behavior of the style.
StyleEdit.BRACESTART and StyleEdit.BRACEEND have been added from Ver.4.1.3 | ||||||||||||
| integer fgColor | Specify the font color with a color constant . | ||||||||||||
| integer bgColor | Specify the background color with a color constant . | ||||||||||||
| integer fontFace | Specifies the decoration attributes of the font.The value follows the FontFace property. | ||||||||||||
| integer fontKind | Specifies the font type. The value follows the FontKind property. | ||||||||||||
| integer fontSize | Specifies the font size. The value follows the FontSize property. | ||||||||||||
| Exception | Func-4 | Invalid arguments | |||||||||||
| Example of use | | ||||||||||||
| Related item | SetStyle, ResetStyle method | ||||||||||||
Regular expressions that can be used with StyleEdit
The regular expression specifications that can be used in the StyleEdit class are as follows. (Specifications are different from the regular expression of RegexPattern class)
| .. | Any character |
| [] | One character in parentheses [abc] matches a, b, c. [A-Z] matches all uppercase alphabets. |
| [^] | One character not included in parentheses |
| ^ ^ | Match at the beginning of the line |
| $ | Match at the end of the line |
| * | Repeat 0 or more times of the previous pattern |
| + | Repeat one or more of the previous pattern |
| \ () | The part enclosed by this can be called later with \ n. Numbers starting from 1 are assigned, and the number is specified for n. |
| \ n | Call the part enclosed in \ (). (N is a number from 1 to 9) |
| \ \ | Escape the metacharacters \ [] * + ^ $ |
Since “" is also an escape character of CRS script, when writing a regular expression in a script, overlap it like “\”. For example, if you want to match the character \, it will be “\\”.