Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 不区分大小写的JFlex正则表达式_Regex_Jflex - Fatal编程技术网

Regex 不区分大小写的JFlex正则表达式

Regex 不区分大小写的JFlex正则表达式,regex,jflex,Regex,Jflex,如何在JFlex中实现不区分大小写的正则表达式模式 使用标准(?i:)符号似乎不起作用 例如: To match the case insensitive word "class", the regex would be (?i:class). But this doesn't work in a JFlex specification. 使用以下指令之一: %无壳 %无知的 发件人: 此选项使JFlex处理规范中的所有字符和字符串,就像它们以大写和小写形式指定一样。这为使用不区分大小写关

如何在JFlex中实现不区分大小写的正则表达式模式

使用标准(?i:)符号似乎不起作用

例如:

To match the case insensitive word "class", the regex would be (?i:class).
But this doesn't work in a JFlex specification.

使用以下指令之一:

  • %无壳
  • %无知的
发件人:

此选项使JFlex处理规范中的所有字符和字符串,就像它们以大写和小写形式指定一样。这为使用不区分大小写关键字的语言指定扫描器提供了一种简单的方法。例如,规范中的字符串“break”的处理方式类似于表达式([bB][rR][eE][aA][kK])。%caseless选项不会更改匹配的文本,也不会影响字符类。因此[a]仍然只匹配角色a,而不匹配角色a。哪些字母是大写字母,哪些是小写字母,由Unicode标准定义,并由JFlex使用Java方法Character.toUpperCase和Character.toLowerCase确定。在JLex兼容模式下(-命令行上的JLex开关),%caseless和%ignorecase也会影响字符类


有没有办法将此标志用于单个规则?例如,我想匹配不区分大小写的关键字。@Gurudevana,我不知道:我建议您自己为此创建一个问题。祝你好运