如何使用JavaScript Regex提取字符串? [英] How to extract a string using JavaScript Regex?
本文介绍了如何使用JavaScript Regex提取字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用JavaScript Regex从文件中提取子字符串.这是文件的一部分:
I'm trying to extract a substring from a file with JavaScript Regex. Here is a slice from the file :
DATE:20091201T220000
SUMMARY:Dad's birthday
我要提取的字段是摘要".方法是:
the field I want to extract is "Summary". Here is the approach:
extractSummary : function(iCalContent) {
/*
input : iCal file content
return : Event summary
*/
var arr = iCalContent.match(/^SUMMARY\:(.)*$/g);
return(arr);
}
推荐答案
查看全文