Need a regular for search in notepad ++

example: There is a string.

Feel free to stop on by, or contact us about your needs. We look forward to hearing from you!

The synonymizer program supports possible synonyms and offers replacements.

{Feel free to | Twenty-four hours a day | Do | Then | You can} stop us by phone, or {contact us | e-mail us | call us | e-mail us | email us} | your preferences | your needs | your family needs}. {We look forward | Good quality} to {hearing from | talking with | listening to | meeting up with} you!

I need to remove the first attachment {****| I understand it will be so find {.*?| replace _пусто_ then, what’s in the center, leave and delete all that is after, and here’s the catch, how to find lines starting with | (inside the attachment of which there are 1-4 delimiters | ) and closes } What does the code look like?

1 answer 1

 \{[^|}]++\|([^|}]++)(?:\|[^|}]++)*\} 

This regular expression will choose the second option from the proposed synonyms.

Check the work here

To make a replacement by text, in the search box, type the above regular expression \{[^|}]++\|([^|}]++)(?:\|[^|}]++)*\} , and in the field for replacement $1 .

Your text after the replacement will look like this:

E-mail us about your requirements. Good quality to talking with you!