Regex检测边界,例如源代码行上的注释
Regex detecting boundaries such as comments on the line of source code
是否可以创建一个正则表达式,它将为以下行返回match/no-match?
/*8th*/break; match
break;/*8th*/ match
/*8th*/ no match
/*8th no match
8th*/ no match
// /* some_comment no match
// some_comment no match
some_comment*/ no match
some_comment // match
如果是,你能给我提供这个正则表达式吗?
基本上,我想了解的是,除了评论之外,是否还有其他内容。
使用正则表达式不能"真正"做到这一点。你可以得到80%的案例,但这是一个复杂的问题。例如,如果您有一个带引号的字符串"*/",regex只会看到*/并认为注释正在关闭。
你可能会很幸运地看到语法高亮器是如何做到这一点的。或者,看看这个庞大的AWK脚本。
相关文章:
- 在Linux中哪里可以找到互斥、未来等的源代码
- Visual Studio 2019:插入多个C++风格的单行注释
- 如果编译的源代码是特定于它编译的硬件的,我们如何分发它
- 使用cmake从源代码构建MySQL连接器/C++失败(与以前的声明冲突)
- 难以理解某些人解决IOI问题的源代码
- 使用g++编译hdf5源代码
- 如何使用C++读取另一个程序中的源代码输出
- Poco FindMySql.cmake 无法找到 MySQL 源代码
- 更改命令行 qt5 源代码构建配置的正确/快速方法
- C++出现控制台错误.我无法识别源代码的问题
- Qt Quick,如何更改 Ui 源代码?
- 使用 Git 处理 C++ Visual Studio 2019 解决方案的外部依赖项源代码管理的最佳方法是什么?
- 使用 Python 和正则表达式提取源代码中的C++注释
- 使用 Doxygen 和非 Doxygen 注释源代码创建文档
- Doxygen:如何链接到带注释的源代码
- 正则表达式到源代码注释
- 收集并显示emacs中源代码中的c++TODO注释列表
- Regex检测边界,例如源代码行上的注释
- 如果我在源代码上插入注释,它的二进制MD5会被改变吗?
- 图像作为源代码文档/注释的一部分