There is a line of text:
Lorem ~Ipsum~ is simply ~dummy~ text ~of~ the printing...
To find all the words enclosed in ~~ I use
re.search(r'~([^~]*)~', text)
Let's say it became necessary to use ~~
instead of ~
([^\~]+)
indicates to exclude the ~
character from the text within those characters
How do I make a regular expression to exclude a string of characters instead of just one?
That is, ~~Lor~em~~
should return Lor~em
The symbol of the new string must not be excluded and the length of the found string cannot be 0