Can you help me to get Regular expression for below

Hi All,

I need to get the Regular Expressions to fetch the below values:

  1. Net Asset Value: $ 2,639,679
  2. Commitment: 3,000,000
  3. Less: Contributions: (2,302,493)
  4. Remaining Capital Commitment: $ 697,507

Please help on this

Here are the regular expressions to extract the values:

  1. Net Asset Value

regex

Net Asset Value:\s*\$?\s*([\d,]+)
  1. Commitment

regex

Commitment:\s*([\d,]+)
  1. Less: Contributions

regex

Less:\s*Contributions:\s*\(?([\d,]+)\)?
  1. Remaining Capital Commitment
Remaining Capital Commitment:\s*\$?\s*([\d,]+)

Each regex captures the numerical values while handling optional dollar signs and parentheses. Let me know if you need modifications! :blush:

Implementation in UiPath Assign Activity:

vb

NetAssetValue = System.Text.RegularExpressions.Regex.Match(inputString, "(?<=net asset value of \$)[\d,]+").Value
RemainingCommitment = System.Text.RegularExpressions.Regex.Match(inputString, "(?<=remaining capital commitment of \$)[\d,]+").Value
TotalCommitment = System.Text.RegularExpressions.Regex.Match(inputString, "(?<=total commitment of \$)[\d,]+").Value

These expressions will extract:

  • Net Asset Value: $2,639,679
  • Remaining Capital Commitment: $697,507
  • Total Commitment: $3,000,000

WHat about Commitment??
the values will be dynamic

Yes RegEx is always dynamic, until you handle properly your string values.

@naveen.s

actually if order is same then thise should do the job to match any numbr…and () generally means they are negative number can replace them once you read and consider value as negative

\(?\d{1,}[\d,]+\)?

cheers

1 Like

@Anil_G ,

I am using the below expression to get Net asset Value but not working:

System.Text.RegularExpressions.Regex.Match(ReadPage2, “((?\d{1,}[\d,]+)?”).Value

Check your String “ReadPage2” once and use it ReadPage2.trim.toString

Hi All ,

I need to fetch these values using regex please help:

Net Asset Value $ 2,639,679
Commitment Summary
Commitment 3,000,000
Less: Contributions (2,302,493)
Remaining Capital Commitment $ 697,507

@naveen.s

duplicate

1 Like

Hi @naveen.s

What is your input data and required output data, could you please specify more to get us understandable.

@naveen.s

first of all check how the values look by writing the data to text file…then we can get the regex for each

cheers

Please find the text as below:

H.R.H Haifa Bint Faisal Bin Fahad AlSaud
CIF:22313102000009

Statement of Partner’s Capital Activity
Quarter To Date Inception To Date
Beginning Capital $ 2,534,631 $ -

Contributions - 2,302,493

Income/(Loss) Allocation
Operating Income/(Expense)
Investment incomedExpenses
Setup and Structuring Costs - (42,211)
Management fee expense (6,371) (11,230)
Professional fees and other expenses (449) (927)
Net Expenses (6,820) (54,368)
Change in Gain/(Loss) on Investments
Change in unrealized gain/(loss) 111,868 391,555
Net Change in Gain/(Loss) on Investments 111,868 391,555
Total Income/(Loss) 105,048 337,187

Net Asset Value $ 2,639,679 $ 2,639,679

Commitment Summary
Commitment 3,000,000
Less: Contributions (2,302,493)
Remaining Capital Commitment $ 697,507

Please find the Input text as below:

H.R.H Haifa Bint Faisal Bin Fahad AlSaud
CIF:22313102000009

Statement of Partner’s Capital Activity
Quarter To Date Inception To Date
Beginning Capital $ 2,534,631 $ -

Contributions - 2,302,493

Income/(Loss) Allocation
Operating Income/(Expense)
Investment incomedExpenses
Setup and Structuring Costs - (42,211)
Management fee expense (6,371) (11,230)
Professional fees and other expenses (449) (927)
Net Expenses (6,820) (54,368)
Change in Gain/(Loss) on Investments
Change in unrealized gain/(loss) 111,868 391,555
Net Change in Gain/(Loss) on Investments 111,868 391,555
Total Income/(Loss) 105,048 337,187

Net Asset Value $ 2,639,679 $ 2,639,679

Commitment Summary
Commitment 3,000,000
Less: Contributions (2,302,493)
Remaining Capital Commitment $ 697,507

Required output Values as below which is highlighted in bold:

1.Net Asset Value $ 2,639,679

2.Commitment 3,000,000
3.Less: Contributions (2,302,493)
4.Remaining Capital Commitment $ 697,507

Okay @naveen.s

You can use the below regular expressions,

  1. NetAsset Value $ 2,639,679
(?<=Net Asset Value \$\s+)[\d\,\.]+

2.Commitment 3,000,000

(?<=Commitment \$\s+)[\d\,\.]+

  1. Less: Contributions (2,302,493)
(?<=Less: Contributions\s*)[\(\)\d\,\.]+

  1. Remaining Capital Commitment $ 697,507
(?<=Remaining Capital Commitment \$\s*)[\d\,\.]+

Hope it helps!!

@naveen.s

please use this

(?<=Net Asset Value *\$ *)\(?\d{1,}[\d,]+\)?

cheers

Hi @naveen.s

1: Net Asset value: (?<=Net Asset Value\s)$\s*[\d,]+
2: Commitment: (?<=Commitment\s)[\d,]+
3: Less: Contributions: (?<=Less: Contributions\s)[-(\d,).]+
4: Remaining Capital Commitment: (?<=Remaining Capital Commitment\s)$\s*[\d,]+

Thanks!!

@naveen.s , please always sanitise the data before publishing online. I think you just published financial information of a member of a royal family. Either you or your employer could end up having to face the legal system.

(?:()?\s*$?\s*([\d,]+)\s*(?:))?

try this