Need REGEX pattern for open close () brackets and asterisk *

Hi @mkankatala,

I need regex for entire description.

For example,

  1. Input:- E SECTION 123(B) NEGATIVE ADJUSTMENTS 45

Regex:- (?<=E SECTION 123(B) NEGATIVE ADJUSTMENTS).* Need pattern like this.

Expected Output:- 45

  1. Input:- C * SECTION 12(E)(3) EXPENDITURES STMT 20

Regex:- (?<=C * SECTION 12(E)(3) EXPENDITURES STMT).* Need pattern like this.

Expected Output:- 20

Note:- Here the input is one line but the one line description will flows in bulk of notes.

Thanks…!

hi @Anbumani
can you alter your regex with this?
(?<=E SECTION 123(B) NEGATIVE ADJUSTMENTS).*?(\d+)

Hi @Anbumani

Try below regex pattern

inputString = You String Description

System.Text.RegularExpressions.Regex.Matches(inputString,“(?<=\s)\d+$”)

Happy Automation :slight_smile:

@Anbumani

Hi @smarthari1997,

I tried, but not have an luck. 0 matches found.

Please advise if I’m doing wrong.

Thanks…!

Hi,

If you need escaped regex pattern, the following sample will help you.

strEscapedPattern = System.Text.RegularExpressions.Regex.Escape("E SECTION 123(B) NEGATIVE ADJUSTMENTS")

Then

System.Text.RegularExpressions.Regex.Match(strInput,$"(?<={strEscapedPattern}).*").Value

Sample
Sample20240130-2.zip (2.5 KB)

Regards,

2 Likes

hi @Anbumani
i have altered it can you try with this
E SECTION 123(B) NEGATIVE ADJUSTMENTS (\d+)

if you still facing issue you can try with @Yoichi approach i believe that will solve your issue

Thanks!

Hi @Anbumani

Check the below regular expressions,
Regex 1 -

(?<=E SECTION 123\(B\) NEGATIVE ADJUSTMENTS )(\d+)

Regex 2 -

(?<=C \* SECTION 12\(E\)\(3\) EXPENDITURES STMT )(\d+)

Hope it helps!!

Thanks @Yoichi,

It’s works as I expected…! :blush: Appreciate it…!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.