Reputation: 21
Hi I want to capture everything before the word contact Eg:
15 Lecky Road
Ballinderyy
Upper Lisburn
BT28 2QA
Contact: Anna Murphy
Telephone: 02892 610634
Fax: 02892 610635
This is my regexp:
(.|\n)*Contact$
Thanks
Upvotes: 0
Views: 149
Reputation: 8332
If you really want to do it with regex, this should do it for you:
^([\s\S]+)\s*Contact
It captures everything, including line feeds and stuff, up to the last occurrence of the word Contact
. If there are multiple Contact
's and you just want to capture up to the first, change the RE to be non-greedy:
^([\s\S]+?)\s*Contact
Upvotes: 0