Regex Help Is not Match

Hi ,

I have a regex expression like this

(?<=\r\n)(.+?)(?= \d{4,5} (?:[\w]+: |Documents))(?:[^a-zA-Z]+)([^\s]+)\s(.+)(?= [A-Z0-9]+ /) (.+)(?=/ \d{2}/\d{2}/\d{4})(?:.*)(?<=\d{2}:\d{2}:\d{2}\s)([\d]+)

This filters and gives me all the matches. I need to get all the items that did not match this pattern in the string. Is It possible to get the values that did not match and get filtered?


How about using Regex.Replace as the following?

System.Text.RegularExpressions.Regex.Replace(yourString,"(?<=\r\n)(.+?)(?= \d{4,5} (?:[\w]+: |Documents))(?:[^a-zA-Z]+)([^\s]+)\s(.+)(?= [A-Z0-9]+ /) (.+)(?=/ \d{2}/\d{2}/\d{4})(?:.*)(?<=\d{2}:\d{2}:\d{2}\s)([\d]+)","")



Simple use string replace
.it will replace your regex match with space and you will get unmatch value

1 Like

Hi Yoichi & Raja

Thank you I was able to get the result.

Is there any way I can add validation to get only those values that are more than 10 characters or numbers in length in this expression?

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