如何获取vb源代码中的所有注释(file.vb) [英] How to get all comments in vb source code (file.vb)

查看:60
本文介绍了如何获取vb源代码中的所有注释(file.vb)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!



我使用vb6读取vb文件,并获取vb文件中的所有注释。我怎样才能在vb6中使用正则表达式。?





谢谢:)

hi everybody!

i am using vb6 for read a vb file, and get all comments in vb file. how can i do it using regular expression in vb6.?


thanks :)

推荐答案

说实话,我不会 - 正则表达式是一个相当愚蠢的对象,并且擅长字符串匹配,但是当涉及到复杂的东西时它是无用的:

To be honest, I wouldn't - a regex is a fairly dumb object and is good at string matching, but it's pretty useless when it comes to complex stuff:
Dim myVar as String = "It's going wrong!" 'Oh yes it is! It's wrong, wrong, wrong...





相反,我会看一个更复杂的解析器,但为什么呢无论如何你想要这样做 - 可能有更好的方法。



Instead I'd look at a more sophisticated parser, but why do you want to do that anyway - there may be a better way to do it.


逐行加载你的源文件,并测试每一行。你想要的是在' REM 之后拿走所有东西。



我不确定正确的正则表达式,我很害怕。我的方法是打开源代码并逐个字符地读取它,将所有内容放在注释指示符和行尾之间。
Load your source file line by line, and test each line. What you want is to take everything after either ' or REM.

I'm not sure of the exact Regex, I'm afraid. My approach would be to open the source and read it character by character, taking everything between a comment indicator and the end of the line.


这篇关于如何获取vb源代码中的所有注释(file.vb)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆