1

I want to form a pattern for a sentence structure. The problem is that those sentences start with special character "-" and ends with "|-|". Example:

-Abendkasse f Theat вечерна каса.|-|
-Abendkleid n вечерна рокля.|-|

How can I form the pattern for this structure and does the difference in language matter?

  • Does this answer your question? [Reference - What does this regex mean?](https://stackoverflow.com/questions/22937618/reference-what-does-this-regex-mean) – SuperStormer Apr 12 '20 at 19:37

1 Answers1

0

I assume you want to match the entire contents of each line, except for those opening and closing characters.

Try this as the pattern:

(?!-).*(?=\|-\|)

This will cause the intial -, and final |-| to be ignored, and will select everything in between. It uses a "negative lookahead" at the start and a "positive lookhead" at the end. See here for another example. We also have to escape each | - hence we use \|.

The mix of languages (German, Russian, I think?) does not matter.

andrewjames
  • 8,705
  • 5
  • 10
  • 31