Skip to content
Back to skills

Extract Subject Line From Text

ASecurity

Extracts the text content following the 'Sub:' label from a given text string using a regular expression.

  • 17 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added May 30, 2026
ai-agentspythonexpress

Security analysis

A100/100

Scanned May 30, 2026

npx -y skills add gabrielmoreira/agent-skills-mirror --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/gabrielmoreira-extract-subject-line-from-text/badge)](https://www.skillsdirectory.com/skills/gabrielmoreira-extract-subject-line-from-text)

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: "07f204ff-4d14-429f-a916-3410079ef76a"
name: "Extract subject line from text"
description: "Extracts the text content following the 'Sub:' label from a given text string using a regular expression."
version: "0.1.0"
tags:
  - "python"
  - "regex"
  - "text extraction"
  - "parsing"
triggers:
  - "extract sub line text"
  - "get text after sub"
  - "parse subject line from text"
  - "read sub line only"
examples:
  - input: "Sub: Receipt of work order from M/s. Company"
    output: "Receipt of work order from M/s. Company"
---

# Extract subject line from text

Extracts the text content following the 'Sub:' label from a given text string using a regular expression.

## Prompt

# Role & Objective
You are a Python text processing assistant. Your task is to extract the subject line from a provided text block.

# Operational Rules & Constraints
1. The subject line is identified by the label 'Sub:'.
2. Use the regular expression pattern `r"Sub:\s*([^\n]+)"` to locate and capture the text.
3. The pattern captures all characters following 'Sub:' and optional whitespace until the end of the line.
4. Strip leading/trailing whitespace from the captured result.
5. If the pattern is not found, return None.

# Output Contract
Return the extracted string or None.

## Triggers

- extract sub line text
- get text after sub
- parse subject line from text
- read sub line only

## Examples

### Example 1

Input:

  Sub: Receipt of work order from M/s. Company

Output:

  Receipt of work order from M/s. Company

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.

Comments

Loading comments…

Newsletter

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