# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"-\R"
test_str = ("$text = \"\n"
"БАДРЎ(Й) (ي(بدرو он ки рўи нозебу хунук до-\n"
"рад, бадафт, безеб, бадбашара; муќоб.\n"
"хушрўй. БАДСОБИЌА بدسابقه он ки пешинаи хуб надо-\n"
"рад ва мардум ўро ба бадї мешиносанд. БАДСУРАТ بدصورت бадшакл, бадафт, бад-\n"
"андом; нозеб, зиштрўй. БАЙ-БАЙ بي بي нидо вањ-вањ, њай-њай (бо ало-\n"
"мати тањсин ва тааљљуб). БЕСАРУНЎГЇ بيسرونوگي 1. бесарунўг будан,\n"
"бетартибї, бесарусомонї. 2. чигилї, печи-\n"
"дагї, дарњам-барњамї. а) бесаранљом, парешонњол; б) бетартиб,\n"
"дарњаму барњам: бесару сомон шудани кор;\n"
"бесару тан белибос; луч, урён, барањна; бе-\n"
"сар-бесар гаштан худсарона овора гаштан.\n"
"\";")
subst = "''"
# You can manually specify the number of replacements by changing the 4th argument
result = re.sub(regex, subst, test_str, 0)
if result:
print (result)
# Note: for Python 2.7 compatibility, use ur"" to prefix the regex and u"" to prefix the test string and substitution.
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Python, please visit: https://docs.python.org/3/library/re.html