import re
regex = re.compile(r".*\n.*\n.*\": \"(.*)\"\n.*", flags=re.MULTILINE)
test_str = (" {\n"
" \"timestamp\": [3344, 3345.04],\n"
" \"text\": \" אבל הוא גם יעלה.\"\n"
" },\n"
" {\n"
" \"timestamp\": [3347.04, 3349.74],\n"
" \"text\": \" בזה, בא מיד ביטחון התשובה,\"\n"
" },\n"
" {\n"
" \"timestamp\": [3349.74, 3351.74],\n"
" \"text\": \" להתעלות האדם גם אחרי הירידות כולן,\"\n"
" },\n"
" {\n"
" \"timestamp\": [3351.74, 3353.24],\n"
" \"text\": \" שאפשר להן להמצא בחיים,\"\n"
" },\n"
" {\n"
" \"timestamp\": [3353.24, 3355.04],\n"
" \"text\": \" תשב אנוש עד דכא\"\n"
" },\n"
" {\n"
" \"timestamp\": [3355.04, 3356.4],\n"
" \"text\": \" ותאמר שובו בני אדם.\"\n"
" },\n"
" {\n"
" \"timestamp\": [3356.4, 3362.04],\n"
" \"text\": \" ברור, אמרת ואפשרת וברור שבסוף כל האדם וכל המציאות תשוב למקורה.\"\n"
" },\n"
" {\n"
" \"timestamp\": [3362.04, 3363.04],\n"
" \"text\": \" בסדר?\"\n"
" },\n"
" {\n"
" \"timestamp\": [3363.04, 3364.57],\n"
" \"text\": \" טוב.\"\n"
" }")
subst = "$1"
result = regex.sub(subst, test_str)
if result:
print(result)
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