-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_extract.py
More file actions
48 lines (34 loc) · 1.01 KB
/
Copy pathtest_extract.py
File metadata and controls
48 lines (34 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import re
def test_extract(md_content):
match = re.search(
r"## Post Content\s*\n+(.*?)(?=\n---|\n## |\Z)",
md_content,
re.DOTALL
)
if match:
content = match.group(1).strip()
if content.startswith("**") and content.endswith("**"):
content = content[2:-2].strip()
return content
return None
# Test with the actual draft content that was created
test_content = """# X (Twitter) Post Draft
## Status: DRAFT - AWAITING APPROVAL
---
## Post Content
**AI doesn't replace humans—it amplifies us.**
The best results come from human creativity + AI capability working together.
Your edge isn't fighting AI. It's collaborating with it.
How are you using AI as your partner? 🤝
#AI #FutureOfWork #HumanAI
---
**Platform:** X (Twitter)
**Generated:** 2026-04-21T11:17:34.892634*
---
## Approval Instructions
"""
result = test_extract(test_content)
print("EXTRACTED CONTENT:")
print("-------------------")
print(repr(result))
print("-------------------")