正则表达式匹配数组

正则表达式匹配数组

问题描述:

大家好。我在阅读文件时有这段代码:

Hi, everyone. I have this code when I''m reading in a file:

展开 | 选择 | Wrap | 行号

你是否必须将整个文件与正则表达式或逐行匹配?
Do you have to match the whole file with the regular expression or line by line?


没关系,只要我可以在文件中搜索那些标签并返回如果发生则为真或假。代码逐行读入我的文件,这可能是更好的方法。感谢您的快速回复。 :)
It doesn''t matter, as long as I can search in the file for those tags and return true or false if they occur. The code reads in my file line-by-line so that might be the preferable method. Thanks for the prompt reply. :)


你需要在字符串上使用search()函数。
You need to use the search() function on the string.
展开 | 选择 | Wrap | 行号