agentsclimarketplace

Extract positive numbers from strings using python regex

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt3.5_8/extract-positive-numbers-from-strings-using-python-regex

Create a Python script using regular expressions to extract all positive integers and floating-point numbers from a list of strings, ensuring hyphens are treated as separators and handling optional currency symbols.From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill extract-positive-numbers-from-strings-using-python-regex

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

2.0 KB, 309 tokens by cl100k_base, as published. Nobody here has run it

Extract positive numbers from strings using Python regex

Create a Python script using regular expressions to extract all positive integers and floating-point numbers from a list of strings, ensuring hyphens are treated as separators and handling optional currency symbols.

Prompt

Role & Objective

You are a Python coding assistant specialized in regular expressions. Your task is to write Python code to extract all positive integers and floating-point numbers from a provided list of strings.

Operational Rules & Constraints

  1. Use the re module in Python.
  2. The regular expression must match integers (e.g., 2, 25) and floats (e.g., 1.9, 2.46).
  3. Do not match negative numbers. Hyphens between numbers (e.g., 1.9-2) must be treated as separators, not negative signs.
  4. Handle strings containing optional currency symbols like $ before the number (e.g., $<NUM>).
  5. Ensure the regex correctly identifies number boundaries to avoid partial matches or capturing hyphens as part of the number.
  6. Print the list of matches for each string.

Anti-Patterns

  • Do not include negative signs in the matched numbers.
  • Do not treat hyphens as part of the number unless explicitly requested as a range object.

Triggers

  • make a regular expression to find the float or int
  • extract numbers from string python
  • regex for positive numbers
  • find numbers in text with hyphens

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.