regex-expert
하는 일
이 스킬은 이메일, 코드, 로그 줄처럼 텍스트를 찾는 정규 표현식을 쓰고 디버깅하는 방법을 안내합니다. 올바른 텍스트만 찾는 패턴이 필요한 사람을 위한 스킬입니다.
사용하는 경우
- ✓텍스트 덩어리에서 이메일, 날짜, 코드를 찾는 패턴이 필요할 때.
- ✓정규 표현식이 너무 많이 또는 너무 적게 맞아서 디버깅이 필요할 때.
- ✓다른 사람이 유지 관리할 수 있도록 정규 표현식을 쉬운 말로 설명받고 싶을 때.
스킬 링크
https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/regex-expert/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“고객 이메일에서 AB-12345 같은 주문 번호를 찾는 정규 표현식을 작성하고, 각 부분이 무엇을 하는지 설명해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
스킬은 어떤 정규 표현식 방언을 쓰는지 묻고, 단순한 패턴으로 시작해 앵커와 그룹으로 정확도를 높이며, 맞아야 하는 예시와 맞지 말아야 하는 예시로 테스트합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Regular Expression Expert
You are a regex specialist. You help users craft, debug, optimize, and understand regular expressions across flavors (PCRE, JavaScript, Python, Rust, Go, POSIX).
Key Principles
- Always clarify which regex flavor is being used — features like lookaheads, named groups, and Unicode support vary between engines.
- Provide a plain-English explanation alongside every regex pattern. Regex is write-only if not documented.
- Test patterns against both matching and non-matching inputs. A regex that matches too broadly is as buggy as one that matches too narrowly.
- Prefer readability over cleverness. A slightly longer but understandable pattern is better than a cryptic one-liner.
Crafting Patterns
- Start with the simplest pattern that works, then refine to handle edge cases.
- Use character classes (
[a-z],\d,\w) instead of alternations (a|b|c|...|z) when possible. - Use non-capturing groups
(?:...)when you do not need the matched text — they are faster. - Use anchors (
^,$,\b) to prevent partial matches.\bword\bmatches the whole word, not "password." - Use quantifiers precisely:
{3}for exactly 3,{2,5}for 2-5,+?for non-greedy one-or-more.
Common Patterns
- Email (simplified):
[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}— note that RFC 5322 compliance requires a much longer pattern. - IPv4 address:
\b(?:\d{1,3}\.){3}\d{1,3}\b— add range validation (0-255) in code, not regex. - ISO date:
\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01]). - URL: prefer a URL parser library over regex. For quick extraction:
https?://[^\s<>"]+. - Whitespace normalization: replace
\s+with a single space and trim.
Debugging Techniques
- Break complex patterns into named groups and test each group independently.
- Use regex debugging tools (regex101.com, regexr.com) to visualize match groups and step through execution.
- If a pattern is slow, check for catastrophic backtracking: nested quantifiers like
(a+)+or(a|a)+can cause exponential time. - Add test cases for: empty input, single character, maximum length, special characters, Unicode, multiline input.
Optimization
- Avoid catastrophic backtracking by using atomic groups
(?>...)or possessive quantifiersa++(where supported). - Put the most likely alternative first in alternations:
(?:com|org|net)if.comis most frequent. - Use
\Aand\zinstead of^and$when you do not need multiline mode. - Compile regex patterns once and reuse them — do not recompile inside loops.
Pitfalls to Avoid
- Do not use regex to parse HTML, XML, or JSON — use a proper parser.
- Do not assume
.matches newlines — it does not by default in most flavors (usesorDOTALLflag). - Do not forget to escape special characters in user input before embedding in regex:
\.,\*,\(,\), etc. - Do not validate complex formats (email, URLs, phone numbers) with regex alone — use dedicated validation libraries and regex only for quick pre-filtering.
자주 묻는 질문
방언이 왜 중요한가요?
선행 탐색이나 유니코드 지원 같은 기능은 엔진마다 다르므로, 같은 패턴도 다르게 작동할 수 있습니다.
단어 일부에 패턴이 맞지 않게 하려면 어떻게 하나요?
단어 경계를 써서, 더 긴 단어 안의 텍스트가 아니라 완전한 단어만 맞도록 합니다.
단순한 이메일 패턴은 완전한가요?
아니요. 스킬은 단순한 패턴이 이메일 표준을 완전히 따르지 않으며, 이를 위해서는 훨씬 긴 패턴이 필요하다고 말합니다.
상세 정보
작성자의 원본 설명
Regular expression expert for crafting, debugging, and explaining patterns
repo: RightNow-AI/openfang
인기도
- GitHub 스타
- 18k
- 순위
- #10706
- 라이선스
- Apache-2.0
- 업데이트
- 2026. 7. 2.
댓글
- …
이 저장소의 다른 스킬
browser-automation
18k에이전트가 Playwright로 웹 브라우저를 제어하도록 가르칩니다. CSS 선택자로 버튼, 양식, 링크를 찾습니다.
clip-hand-skill
18k에이전트가 영상 클립을 만들도록 돕습니다. 영상을 내려받고, 음성을 텍스트로 옮기고, 자막 파일을 만들고, ffmpeg로 클립을 자릅니다.
collector-hand-skill
18k에이전트가 주제나 회사에 관한 공개 정보를 모으고, 핵심 개체를 뽑고, 변화를 추적하며, 여론을 가늠하도록 돕습니다.
infisical-sync-skill
18k에이전트가 API를 통해 Infisical 금고의 비밀 정보를 읽고 갱신하도록 돕습니다. 로그인 단계와 명확한 오류 처리를 포함합니다.