Split sentance using regex

Hi,
How to split the sentence using Regex.

Sentance below:
“§13b Abs.2 Nr.7 UStG. Steuer Nr. Firma ArcelorMittal Recycling SAS:”

I need like this:
§13b Abs.2 Nr.7 UStG.
Steuer Nr. Firma ArcelorMittal Recycling SAS:

Hi @Prasaanth_S

splitArray = System.Text.RegularExpressions.Regex.Split("§13b Abs.2 Nr.7 UStG. Steuer Nr. Firma ArcelorMittal Recycling SAS:", "Steuer Nr.")

splitArray(0) contains §13b Abs.2 Nr.7 UStG.
splitArray(1) contains Steuer Nr. Firma ArcelorMittal Recycling SAS:

Hi @Prasaanth_S

Try this


System.Text.RegularExpressions.Regex.Replace(Input.ToString,"((?<=[A-Z]\.)\s+)",Environment.NewLine)

Hope this helps!!

1 Like

@Prasaanth_S

can you please tell what is the constant part in it…or how do you identify manually from where to split?

couple more examples would help in getting a pattern if any

cheers

1 Like

@Prasaanth_S

Input_str.Replace(“UStG.”,“UStG.”&vbCrLf &“”)

image

Hi @Prasaanth_S

can you please let us know what is the constant part in the string, or how we can identify exactly from where we need to split the string?

Thank you

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