REGEX PDF Automation

Hi team,

kindly help me out.

I have input string of Medicare Medicare

I would like to add hyphen (- ) like Medicare - Medicare

I tried the below syntax
System.Text.RegularExpressions.Regex.Replace(Ins1Sentence,FirstOccurrence,"- "+FirstOccurrence)

Got the Output like - Medicare - Medicare

Can anyone help me out to get the exact output like Medicare - Medicare

Thanks In Advance

Hi,

How about the following?

System.Text.RegularExpressions.Regex.Replace(Ins1Sentence,"(?<="+FirstOccurrence+")\s+(?="+FirstOccurrence+")"," - ")

Regards,

Hi @manikandan.murugan

Try this:

Input: "Medicare Medicare"
Output: Input.Replace(" "," - ")

Regards,

Hi Yoichi,

Its working and thanks. My question may be Incorrect

In the below pattern, its not splitting with the -

BCBS BLUE ESSENTIALS BLUE ESSENTIALS NETWORK HIX BCBS

image

I would like to get the output mentioned below

BCBS BLUE ESSENTIALS - BLUE ESSENTIALS NETWORK HIX BCBS

Can you please help me…

Thanks in Advance

Hi @manikandan.murugan

If possible could you share input text and output text.

Regards

Hi,

If we set FirstOccurrence “BLUE ESSENTIALS”, it works as the following. Isn’t this what you expect?

Regards,

yes This is I expect exactly, But for me its not working

Hi,

Probably, exact string is necessary. Can you share your input as text file? It’s no problem if dummy data.

Regards,

Hi Yoichi,

here I have attached the sample Input file

Thanks in Advance
Input.txt (525 Bytes)

Hi,

How do we get FirstOccurrence? Can we set it manually in advance, or using some method?

Regards,

we can set it manually

In my environment. it works well as the following.

Sequence2.xaml (6.9 KB)

1 Like

Hi Yoichi,

image

This means \s right

Oh, sorry, backslash is displayed as yen sign in my Japanese environment.
Please use backslash like the first expression.

System.Text.RegularExpressions.Regex.Replace(Ins1Sentence,"(?<="+FirstOccurrence+")\s+(?="+FirstOccurrence+")"," - ")

Regards,

1 Like

Thanks Yoichi and Its working now. Its a good solution

1 Like

Hi @manikandan.murugan

You can try this way. This will work for all the inputs you have. Check out the workflow file.
Sequence4.xaml (12.9 KB)

Output:
image

Regards

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