# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"^.*\V\K\R{2,}"
test_str = ("Storage\n"
"The powerful quad-core Intel X5 processor in Transformer Book T101HA means you'll have no problem breezing through all your everyday tasks,\n"
"with seamless multitasking allowing you to get more done in less time. Storage is conveniently flexible, too. Inside, there's 128GB of super-fast flash storage, and it's easily expandable via the micro SD card slot. You also get you a year's free unlimited cloud storage on ASUS WebStorage!\n\n"
"Color|White/Gold\n\n\n\n\n\n"
"CPU|Innn dsafdsfdfa \n\n\n\n\n\n\n\n"
" dfnn")
subst = "@@"
# You can manually specify the number of replacements by changing the 4th argument
result = re.sub(regex, subst, test_str, 1, re.DOTALL)
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