# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"\s(([a-zA-Z]+\-[a-zA-Z]+|[a-zA-Z]+)\.)"
test_str = ("<p>With consumers becoming more and more health-conscious by the minute, the wearable fitness tracker market is ever-expanding.</p>\n"
"<p>So, to cut through the clutter, we created a lifestyle video series and an interactive kiosk experience at Best Buy, where we were able to inform and educate consumers about Jawbone’s Up products right there at point of sale.</p>\n"
"<p>By arming consumers with the knowledge on how to improve their personal physical fitness, they’re able to make informed decisions with the push of a button. As part of the experience, visually stimulating films helped people easily understand each product’s features and benefits as well as identify which product best fit their needs.</p>\n"
"<p>The lifestyle and product demonstration films within the interactive experience were also used across social media, the Jawbone website, and as TV spots in two countries.</p>\n"
"<div class=\"image\"><a href=\"http://goldenarm.com/staging/wp-content/uploads/2015/06/UpKiosk.jpg\"><img class=\"aligncenter wp-image-1156 size-large\" src=\"http://goldenarm.com/staging/wp-content/uploads/2015/06/UpKiosk-1024x643.jpg\" alt=\"\" width=\"1024\" height=\"643\"></a><img class=\"aligncenter wp-image-1348 size-large\" src=\"http://goldenarm.com/staging/wp-content/uploads/2015/06/6.-youpush-1600px-1024x576ABC.jpg\" alt=\"\" width=\"1024\" height=\"576\"></div>\n"
"<p class=\"work-page__video_container\"><div class=\"video-embed\"><iframe src=\"https://player.vimeo.com/video/122136552\" width=\"500\" height=\"281\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"></iframe></div><br>\n"
"<div class=\"video-embed\"><iframe src=\"https://player.vimeo.com/video/122136232\" width=\"500\" height=\"281\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"></iframe></div></p>\n"
"<div class=\"image\"><a style=\"font-size: 20px;\" href=\"http://goldenarm.com/staging/wp-content/uploads/2015/06/Screen-Shot-2015-06-23-at-2.55.39-PM.png\"><img class=\"alignnone size-full wp-image-857\" src=\"http://goldenarm.com/staging/wp-content/uploads/2015/06/Screen-Shot-2015-06-23-at-2.55.39-PM.png\" alt=\"Screen Shot 2015-06-23 at 2.55.39 PM\" width=\"639\" height=\"638\"></a></div>")
subst = " $1"
# 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