正则表达式匹配数组 [英] regular expression matches in an array

查看:309
本文介绍了正则表达式匹配数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.
展开 | < span class =codeLinkonclick =selectAll(this);>选择 | Wrap | 行号


这篇关于正则表达式匹配数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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