Click here to Skip to main content
15,845,598 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
From resume text, I want to extract the number of years of experience of a candidate.

How I intended on obtaining this-->
Years of experience is usually mentioned as '4 years' or '6+ years'.

How do I include '+' in the code while ensuring that the symbol's literal meaning(One or more occurrences) isn't considered?

Also, how to accept a decimal number in the same - Eg: 6.5 Years?

What I have tried:

The following code works only when the number is mentioned as 'X years'.

< lang="Python">
<pre>exp_p='[^\d]*(\d*) years|Years|year|Year
Updated 15-Sep-22 11:16am

1 solution

[^\d]*(\d*\+?) years|Years|year|Year
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900