# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"(?<=\"aspectRatio\"\:\s\")\d+:\d+"
test_str = ("{\n"
" \"timeline\": {\n"
" \"background\": \"#---secondaryColor---\",\n"
" \"fonts\": [\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/Arial-Black.ttf\"\n"
" },\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/Arial-BoldItalicMT.ttf\"\n"
" },\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/Arial-BoldMT.ttf\"\n"
" },\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/Arial-ItalicMT.ttf\"\n"
" },\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/Arial.ttf\"\n"
" },\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/ArialNarrow-Bold.ttf\"\n"
" },\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/ArialNarrow-BoldItalic.ttf\"\n"
" },\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/ArialNarrow-Italic.ttf\"\n"
" },\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/ArialNarrow.ttf\"\n"
" },\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/Caveat-Regular.ttf\"\n"
" },\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/Georgia-Bold.ttf\"\n"
" },\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/Georgia-BoldItalic.ttf\"\n"
" },\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/Georgia-Italic.ttf\"\n"
" },\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/Georgia.ttf\"\n"
" },\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/Nunito-Black.ttf\"\n"
" },\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/Nunito-BlackItalic.ttf\"\n"
" },\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/Nunito-Bold.ttf\"\n"
" },\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/Nunito-BoldItalic.ttf\"\n"
" },\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/Nunito-ExtraBold.ttf\"\n"
" },\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/Nunito-ExtraBoldItalic.ttf\"\n"
" },\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/Nunito-ExtraLight.ttf\"\n"
" },\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/Nunito-ExtraLightItalic.ttf\"\n"
" },\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/Nunito-Italic.ttf\"\n"
" },\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/Nunito-Light.ttf\"\n"
" },\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/Nunito-LightItalic.ttf\"\n"
" },\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/Nunito-Regular.ttf\"\n"
" },\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/Nunito-SemiBold.ttf\"\n"
" },\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/Nunito-SemiBoldItalic.ttf\"\n"
" },\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/TimesNewRomanPS-BoldItalicMT.ttf\"\n"
" },\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/TimesNewRomanPS-BoldMT.ttf\"\n"
" },\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/TimesNewRomanPS-ItalicMT.ttf\"\n"
" },\n"
" {\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/fonts/TimesNewRomanPSMT.ttf\"\n"
" }\n"
" ],\n"
" \"tracks\": [\n"
" {\n"
" \"clips\": [\n"
" {\n"
" \"asset\": {\n"
" \"type\": \"html\",\n"
" \"html\": \"<p>---eventName---</p><p class='date'>---openHouseDate---</p>\",\n"
" \"css\": \"p {font-family: '---primaryFont---'; text-align: center; ---primaryFontStyle---; color: #---secondaryColor---; font-size: 90px; line-height: 80%;} .date {font-size: 40px}\",\n"
" \"width\": 1080,\n"
" \"height\": 200\n"
" },\n"
" \"start\": 0,\n"
" \"length\": 4,\n"
" \"position\": \"top\",\n"
" \"offset\": {\n"
" \"y\": 0.02\n"
" }\n"
" }\n"
" ]\n"
" },\n"
" {\n"
" \"clips\": [\n"
" {\n"
" \"asset\": {\n"
" \"type\": \"html\",\n"
" \"html\": \"<p class='address'>---propertyAddress---</p><p>---bedAmount--- Bed | ---bathAmount--- Bath</p><p>---propertySurface---</p><p>---currentPrice---</p>\",\n"
" \"css\": \"p {color: #---primaryColor---; text-align: center; font-size: 40px; ---primaryFontStyle---; font-family: '---primaryFont---'; line-height: 80%;} .address {font-size: 60px}\",\n"
" \"width\": 980,\n"
" \"height\": 320,\n"
" \"background\": \"#---secondaryColor---\"\n"
" },\n"
" \"start\": 0,\n"
" \"length\": 4,\n"
" \"position\": \"bottom\"\n"
" }\n"
" ]\n"
" },\n"
" {\n"
" \"clips\": [\n"
" {\n"
" \"asset\": {\n"
" \"type\": \"luma\",\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/luma/Template31-22-1080x1350.jpg\"\n"
" },\n"
" \"start\": 0,\n"
" \"length\": 4\n"
" },\n"
" {\n"
" \"asset\": {\n"
" \"type\": \"html\",\n"
" \"html\": \"<div></div>\",\n"
" \"background\": \"#---primaryColor---\",\n"
" \"width\": 1080,\n"
" \"height\": 1350\n"
" },\n"
" \"start\": 0,\n"
" \"length\": 4,\n"
" \"position\": \"center\"\n"
" }\n"
" ]\n"
" },\n"
" {\n"
" \"clips\": [\n"
" {\n"
" \"asset\": {\n"
" \"type\": \"html\",\n"
" \"html\": \"<p></p>\",\n"
" \"width\": 95,\n"
" \"height\": 695,\n"
" \"background\": \"#---secondaryColor---\"\n"
" },\n"
" \"start\": 0,\n"
" \"length\": 4,\n"
" \"position\": \"bottomLeft\"\n"
" }\n"
" ]\n"
" },\n"
" {\n"
" \"clips\": [\n"
" {\n"
" \"asset\": {\n"
" \"type\": \"html\",\n"
" \"html\": \"<p></p>\",\n"
" \"width\": 95,\n"
" \"height\": 695,\n"
" \"background\": \"#---secondaryColor---\"\n"
" },\n"
" \"start\": 0,\n"
" \"length\": 4,\n"
" \"position\": \"bottomRight\"\n"
" }\n"
" ]\n"
" },\n"
" {\n"
" \"clips\": [\n"
" {\n"
" \"asset\": {\n"
" \"type\": \"image\",\n"
" \"src\": \"---propertyPhoto1---\"\n"
" },\n"
" \"start\": 0,\n"
" \"length\": 4,\n"
" \"position\": \"bottom\",\n"
" \"fit\": \"crop\",\n"
" \"scale\": 0.8,\n"
" \"transition\": {\n"
" \"in\": \"carouselUpSlow\"\n"
" },\n"
" \"offset\": {\n"
" \"y---horizontalPhoto1---\": 0.24,\n"
" \"y---verticalPhoto1---\": 0.15\n"
" }\n"
" }\n"
" ]\n"
" },\n"
" {\n"
" \"clips\": [\n"
" {\n"
" \"asset\": {\n"
" \"type\": \"html\",\n"
" \"html\": \"<p></p>\",\n"
" \"width\": 1080,\n"
" \"height\": 655,\n"
" \"background\": \"#---primaryColor---\"\n"
" },\n"
" \"start\": 0,\n"
" \"length\": 4,\n"
" \"position\": \"top\"\n"
" }\n"
" ]\n"
" },\n"
" {\n"
" \"clips\": [\n"
" {\n"
" \"asset\": {\n"
" \"type\": \"html\",\n"
" \"html\": \"<p>---callToAction---</p>\",\n"
" \"css\": \"p {color: #000000; font-size: 58px; ---secondaryFontStyle---; font-family: '---secondaryFont---'}\",\n"
" \"width\": 900,\n"
" \"height\": 200\n"
" },\n"
" \"start\": 4,\n"
" \"length\": 3,\n"
" \"position\": \"top\",\n"
" \"transition\": {\n"
" \"in\": \"fade\"\n"
" }\n"
" },\n"
" {\n"
" \"asset\": {\n"
" \"type\": \"html\",\n"
" \"html\": \"<p class='big'>---agentFirstName--- ---agentLastName---</p><p>---agentTitle---</p><p>---agentEmail---</p><p>---agentPhone---</p><p class='small'><br />---agentFirmName---<br />---agentFirmAddress---<br />---agentFirmWebsite---</p>\",\n"
" \"css\": \"p {color: #000000; font-size: 30px; ---secondaryFontStyle---; font-family: '---secondaryFont---'; margin-top: 0; margin-bottom: 0} .big {font-size: 58px} .small {font-size: 24px}\",\n"
" \"width\": 900,\n"
" \"height\": 540\n"
" },\n"
" \"start\": 4,\n"
" \"length\": 3,\n"
" \"position\": \"bottom\",\n"
" \"offset\": {\n"
" \"y\": 0.02\n"
" },\n"
" \"transition\": {\n"
" \"in\": \"fade\"\n"
" }\n"
" }\n"
" ]\n"
" },\n"
" {\n"
" \"clips\": [\n"
" {\n"
" \"asset\": {\n"
" \"type\": \"luma\",\n"
" \"src\": \"https://perry-template-assets.s3.us-east-2.amazonaws.com/luma/circle-1080x1350agent.jpg\"\n"
" },\n"
" \"start\": 4,\n"
" \"length\": 3\n"
" },\n"
" {\n"
" \"asset\": {\n"
" \"type\": \"html\",\n"
" \"html\": \"<div></div>\",\n"
" \"background\": \"#D9---secondaryColor---\",\n"
" \"width\": 1080,\n"
" \"height\": 1350\n"
" },\n"
" \"start\": 4,\n"
" \"length\": 3,\n"
" \"position\": \"center\"\n"
" }\n"
" ]\n"
" },\n"
" {\n"
" \"clips\": [\n"
" {\n"
" \"asset\": {\n"
" \"type\": \"image\",\n"
" \"src\": \"---agentPhoto---\"\n"
" },\n"
" \"start\": 4,\n"
" \"length\": 3,\n"
" \"fit\": \"crop\",\n"
" \"scale---horizontalAgentPhoto---\": 0.5,\n"
" \"scale---verticalAgentPhoto---\": 0.6,\n"
" \"position\": \"top\",\n"
" \"offset\": {\n"
" \"y---horizontalAgentPhoto---\": -0.12,\n"
" \"y---verticalAgentPhoto---\": -0.135\n"
" },\n"
" \"transition\": {\n"
" \"in\": \"fadeFast\"\n"
" }\n"
" }\n"
" ]\n"
" }\n"
" ],\n"
" \"cache\": true\n"
" },\n"
" \"output\": {\n"
" \"format\": \"mp4\",\n"
" \"resolution\": \"1080\",\n"
" \"aspectRatio\": \"4:5\",\n"
" \"quality\": \"medium\",\n"
" \"poster\": {\n"
" \"capture\": 2\n"
" },\n"
" \"destinations\": [\n"
" {\n"
" \"provider\": \"shotstack\",\n"
" \"exclude\": true\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