Removing a line that ends with a certain word

Hi there i have a string that is scraped and is formatted like this:

Susy Smith's Profile
jffjfldjfldfldjfldjldlfd
Email
susy@email.com
Birthday
Jan 3, 2000

Each string that is going to be scraped is going to have a different name and so i think that it is better to remove that line based on the last word ‘Profile’ I used the following regex i tweaked from a previous question but it doesn’t work. Would appreciate your help. Thank you in advance!!
System.Text.RegularExpressions.Regex.Replace(testString,“$ Profile.*”," ",System.Text.RegularExpressions.RegexOptions.Multiline)

Hi,

Do you need to remove a line which ends with “Profile”?
If so, the following will work.

System.Text.RegularExpressions.Regex.Replace(yourString,"^.*Profile\r?\n","",System.Text.RegularExpressions.RegexOptions.Multiline)

Regards,

1 Like

oh my gosh @Yoichi I LOVE YOU!!!:orange_heart::raising_hand_woman:
Thank you for your help!!!

1 Like

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