Regular expression split string

Hi Guys,

Am trying to split the string as like below, but am getting following error for the same:

System.Text.RegularExpressions.Regex.Match(FileName,“(?<=EBBIND98**STANDARD)([\S\s]*)(?=PREFERRED PRIMARY)”).Value.Trim

Assign: parsing “(?<=EBBIND98**STANDARD)([\S\s]*)(?=PREFERRED PRIMARY)” - Nested quantifier *.

Please let me know how to fix the same.

Thanks,
Gokul.

1 Like

You can’t have two asterisks ** in the expression. An asterisk means match one or more of the previous character. To match literal asterisks you need to escape them as \*.

image

1 Like

Hi @gokulvasant

System.Text.RegularExpressions.Regex.Match(FileName,"(?<=EBBIND98*STANDARD)([\S\s]*)(?=PREFERRED PRIMARY)").Value.Trim

Please try the above regex , if still facing the issue , please paste the input string so that we could help with the pattern.

Thanks.

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