মূল বিষয়বস্তুতে যান
kitlocal.dev

Regex চিটশিট

লোকালি চলে

১০০% আপনার ব্রাউজারে প্রসেস হয়। ইনপুট ও আউটপুট কখনো আপনার ডিভাইস ছেড়ে যায় না।

ইন্টারঅ্যাকটিভ লাইভ ম্যাচার ল্যাবসহ রেগুলার এক্সপ্রেশন সিনট্যাক্স ও পুনরায় ব্যবহারযোগ্য রেসিপি: অ্যাঙ্কর, ক্যারেক্টার ক্লাস, কোয়ান্টিফায়ার, লুকঅ্যারাউন্ড ও ফ্ল্যাগ (ES2024)।

যেভাবে কাজ করে

A regex engine scans left-to-right trying to satisfy your pattern at each position. Quantifiers (*, +, {n,m}) are greedy by default (consuming as much as possible before backtracking); append `?` to make them lazy, and anchor with `^`/`$` or `\b` when you need exact boundaries.

সারভাইভাল কিট

যে কয়েকটি কমান্ড সবার আগে শিখতে হবে।

৪১টি কমান্ড

কীবোর্ড শর্টকাট/সার্চে ফোকাস করুনJKনির্বাচন সরানCনির্বাচিতটি কপি করুনFনির্বাচিতটি বুকমার্ক করুনEscসার্চ মুছুন

Characters & character classes

Match single characters by category (`\d`, `\w`, `\s`) or explicit sets (`[a-f0-9]`). Uppercase shorthands invert the match.

অফিসিয়াল ডকুমেন্টেশন: Character classes
  • অপরিহার্য

    Match a digit, word character ([A-Za-z0-9_]) or whitespace.

    \d  \w  \s

    কখন ব্যবহার করবেন

    Core shorthand character classes used in almost every pattern.

    বিশ্লেষণ

    \d
    ASCII digit [0-9] (uppercase \D = non-digit)
    \w
    alphanumeric + underscore (uppercase \W = non-word)
    \s
    space, tab or newline (uppercase \S = non-whitespace)

    উদাহরণ

    Matches dates inside `"release 2026-11-15"`.

    \d{4}-\d{2}-\d{2}

    ফলাফল

    ["2026-11-15"]

    আরও দেখুন

Anchors & boundaries

Anchors match positions (start/end of string, line or word) rather than consuming characters.

অফিসিয়াল ডকুমেন্টেশন: Assertions

Quantifiers & laziness

Control how many times the preceding token repeats. Add `?` after any quantifier to match as few times as possible.

অফিসিয়াল ডকুমেন্টেশন: Quantifiers

Groups, alternation & backreferences

Parentheses group sub-expressions for quantifiers/alternation and capture text for extraction or backreferences.

অফিসিয়াল ডকুমেন্টেশন: Groups and backreferences

Lookaheads, lookbehinds & flags

Check what appears ahead or behind the current position without making it part of the matched text.

অফিসিয়াল ডকুমেন্টেশন: Assertions & flags

KitLocal টুলে এটি চেষ্টা করে দেখুন

শব্দকোষ
Greedy vs Lazy
`.*` grabs to the last possible match; `.*?` stops at the earliest match.
Lookaround
Zero-width assertion (`(?=...)`, `(?!...)`, `(?<=...)`) that checks surrounding text without consuming characters.
Backtracking
When a quantifier gives up matched characters so later tokens can match; nested `*`/`+` can cause ReDoS.
Zero-width
Tokens like `^`, `$`, `\b` and lookarounds that match a position rather than characters.

১৫ নভে, ২০২৬ তারিখে যাচাইকৃত · ES2024 RegExp-এর বিপরীতে যাচাইকৃত

উৎস: MDN Regular Expressions Guide · MDN RegExp Reference

অ্যাঙ্গেল ব্র্যাকেটের ভেতরের অংশগুলো আপনার নিজস্ব মান দিয়ে প্রতিস্থাপন করুন। কমান্ডগুলো অফিসিয়াল ডকুমেন্টেশন থেকে নেওয়া হয়েছে এবং প্রদর্শিত সংস্করণে উদাহরণগুলো পরীক্ষা করা হয়েছে।