I need to remove all text in between A and B
A is two know words "Express transportation" B is also two know words plus full stop "kind customers."
I wish to use RegEx to remove everything starting from "Express transportation" all the way to "kind customers." (including these matching words)
I tried a bunch of RegEx builder, no luck.
CodePudding user response:
It's helpful to provide your exact code, and the achieved result in combination with an expected result. It's also possible to edit/improve your question if someone writes a comment.
Anwyways, as far as I understood , this regular expression should help you:
Express\stransportation. kind\scustomers
This matches following string for example:
Express transportation balwfwe0fujefuawenf0uewafewfekind customers
partwise Regex Explanation
- List item
Express
=> Matches the word "Express" literally\s
=> matches a space charactertransportation
=> matches the word "transportation" literally.
=> Matches any character except line terminators! 1-infinite timeskind
=> Matches the word "kind" literally\s
=> matches a space charactercustomers
=> matches the word "customers" literally
your regex
(?<=Express\ transportation).*
This regex matches everything after the string Express transportation.
?<=
is a lookahead and actually does not include a matching character.
I suggest you to check out regex101 website. It allows you to build up and test Regex expressions and gives a bit of an explanation about them.