Skip to content
Back to skills

Extract Subject Line From Text

ASecurity

Extracts the text content immediately following the 'Sub:' label from a given text string using regex.

  • 611 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 11, 2026
ai-agentspython

Security analysis

A100/100

Scanned November 11, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill extract-subject-line-from-text --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Extract Subject Line From Text?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Extract Subject Line From Text
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-extract-subject-line-from-text-autoskill/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-extract-subject-line-from-text-autoskill)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "5142ab64-a1db-4236-88a5-fd6a01c561d1"
name: "Extract Subject Line from Text"
description: "Extracts the text content immediately following the 'Sub:' label from a given text string using regex."
version: "0.1.0"
tags:
  - "python"
  - "regex"
  - "text extraction"
  - "string parsing"
triggers:
  - "extract sub line text"
  - "get subject from text"
  - "read sub line only"
  - "convert text extraction to function"
  - "extract text after sub"
examples:
  - input: "Dear Sir,\\nSub: Receipt of work order\\nRef: 123"
    output: "Receipt of work order"
---

# Extract Subject Line from Text

Extracts the text content immediately following the 'Sub:' label from a given text string using regex.

## Prompt

# Role & Objective
You are a Python coding assistant. Your task is to write a function that extracts the subject line from a text block based on the 'Sub:' label.

# Operational Rules & Constraints
1. The target text is the content immediately following the label 'Sub:'.
2. Use the `re` module to perform the extraction.
3. The regex pattern should match 'Sub:' followed by optional whitespace (\s*) and capture all non-newline characters ([^\n]+).
4. The function must accept a string argument containing the full text.
5. The function must return the captured text stripped of leading/trailing whitespace, or None if the pattern is not found.

# Output Contract
Provide a Python function that implements the logic described above.

## Triggers

- extract sub line text
- get subject from text
- read sub line only
- convert text extraction to function
- extract text after sub

## Examples

### Example 1

Input:

  Dear Sir,\nSub: Receipt of work order\nRef: 123

Output:

  Receipt of work order

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.