Extract all the numbers from string and output their SUM. I’m struggling to achieve same using REGEX in powershell<\/p>\n
String ='“Total Facility A Commitments” means the aggregate of the Facility A Commitments, being £2,500,000 at the date of this Agreement.
\n“Total Facility B Commitments” means the aggregate of the Facility B Commitments, being £2,500,000 at the date of this Agreement.
\n“Total Facility C Commitments” means the aggregate of the Facility C Commitments, being £2,500,000 at the date of this Agreement.
\n[“Total Incremental Facility Commitments” means, in relation to an Incremental Facility, the aggregate of the Incremental Facility Commitments relating to that Incremental Facility.] ’
\nOutput = £7,500,000<\/p>","upvoteCount":3,"answerCount":4,"datePublished":"2018-10-16T12:48:57.000Z","author":{"@type":"Person","name":"lokeshsharma7","url":"https://community.spiceworks.com/u/lokeshsharma7"},"suggestedAnswer":[{"@type":"Answer","text":"
Extract all the numbers from string and output their SUM. I’m struggling to achieve same using REGEX in powershell<\/p>\n
String ='“Total Facility A Commitments” means the aggregate of the Facility A Commitments, being £2,500,000 at the date of this Agreement.
\n“Total Facility B Commitments” means the aggregate of the Facility B Commitments, being £2,500,000 at the date of this Agreement.
\n“Total Facility C Commitments” means the aggregate of the Facility C Commitments, being £2,500,000 at the date of this Agreement.
\n[“Total Incremental Facility Commitments” means, in relation to an Incremental Facility, the aggregate of the Incremental Facility Commitments relating to that Incremental Facility.] ’
\nOutput = £7,500,000<\/p>","upvoteCount":3,"datePublished":"2018-10-16T12:48:57.000Z","url":"https://community.spiceworks.com/t/extract-numbers-from-string-using-regex-in-powershell/678829/1","author":{"@type":"Person","name":"lokeshsharma7","url":"https://community.spiceworks.com/u/lokeshsharma7"}},{"@type":"Answer","text":"
You said you are struggeling, what have you tried so far?<\/p>\n
Please share your code so we can help.<\/p>\n
You can use the ‘-match’ operator and then look for numbers in the string.<\/p>\n
If you post code, please use the insert code button! Please and thank you!<\/p>