我有一份简历数据集,我想从每份简历中提取数据 我将举例说明我需要的样本
String test= "Worked in Innovision Information System Private Limited as Project Trainee-Content Writing from Date to Date.";
我想提取company name
,role (designation)
和Date (From-to)
我是正则表达式的新手,所以如果我错了请纠正我
我试图分别提取每一个
String regexStr5="Worked in:? \\w+" ;
String regexStr6 ="as:? ([a-zA-Z ]+)";
以及日期Date : (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{1,2}, \d{4}
如何将它们全部放在同一个正则表达式中?!!
并打印company-Name +role+date
答案 0 :(得分:4)
对于上面的测试字符串,文字字符串匹配就好了。
正则表达式: Worked in (.*) as (.*) from (.*) to (.*).
替换为: Company Name: \1\nRole (designation): \2\nDate: \3 to \4
<强> Regex101 Demo 强>