Search code examples
regexworkflow

Remove the text until the matching string using regex


I am having an issue with using regex for deleting everything before the String.

Given String: xyz@gmail.com No TEST NOTE. If you are not an intended recipient

Expected result: TEST NOTE. If you are not an intended recipient

The regex I am using to delete the preceding part is [^*] * No

But it is deleting a part of the expected result as well and giving me t an intended recipient as a result.


Solution

  • This will match exactly the part, that you want to delete:

    ^[^\s]+\sNo\s