İçeriğe geç
uxTools
Geliştirici

Regex Hile Sayfası

Kategorilere göre gruplanmış, aranabilir bir düzenli ifade söz dizimi başvurusu. Canlı olarak filtreleyin ve herhangi bir ifadeyi tek tıkla kopyalayın.

51

İfade

7

Kategori

51

Gösterilen

İfade ara

Karakter sınıfları

12
  • .

    Any single character except a line break (unless the s flag is set).

    Örneka.c matches abc, axc
  • [abc]

    Any one of the listed characters (a, b, or c).

    Örnek[aeiou] matches a single vowel
  • [^abc]

    Any single character that is NOT one of the listed characters.

    Örnek[^0-9] matches a non-digit
  • [a-z]

    Any character in the given range (here, a lowercase letter).

    Örnek[A-Fa-f0-9] matches a hex digit
  • \d

    Any digit. Equivalent to [0-9].

    Örnek\d\d matches 42
  • \D

    Any non-digit character. Equivalent to [^0-9].

  • \w

    Any word character: a letter, digit, or underscore. Same as [A-Za-z0-9_].

    Örnek\w+ matches snake_case_99
  • \W

    Any non-word character. Equivalent to [^A-Za-z0-9_].

  • \s

    Any whitespace character: space, tab, newline, carriage return, form feed.

    Örnek\s+ collapses runs of spaces
  • \S

    Any non-whitespace character.

  • \.

    A literal dot. Backslash-escape any metacharacter to match it literally.

    Örnek\d+\.\d+ matches 3.14
  • \t

    A literal tab character. Likewise \n (newline) and \r (carriage return).

Çapalar ve sınırlar

6
  • ^

    Start of the string (or start of a line with the m flag).

    Örnek^Error matches lines beginning with Error
  • $

    End of the string (or end of a line with the m flag).

    Örnek\.csv$ matches a filename ending in .csv
  • \b

    A word boundary: the position between a word and a non-word character.

    Örnek\bcat\b matches cat but not category
  • \B

    A non-word boundary: any position that is not a word boundary.

    Örnek\Bend matches the end in weekend
  • \A

    Start of the string only, never a line start (PCRE; not in JavaScript).

  • \z

    Very end of the string only (PCRE; not in JavaScript).

Niceleyiciler

8
  • *

    Zero or more of the preceding token (greedy).

    Örnekab*c matches ac, abc, abbbc
  • +

    One or more of the preceding token (greedy).

    Örnek\d+ matches one or more digits
  • ?

    Zero or one of the preceding token (makes it optional).

    Örnekcolou?r matches color and colour
  • {n}

    Exactly n of the preceding token.

    Örnek\d{4} matches a four-digit year
  • {n,}

    At least n of the preceding token.

    Örnek\d{2,} matches two or more digits
  • {n,m}

    Between n and m of the preceding token, inclusive.

    Örneka{1,3} matches a, aa, or aaa
  • *?

    Lazy (non-greedy) match: as few repetitions as possible. Also +?, ??, {n,m}?.

    Örnek<.*?> matches one tag, not the whole line
  • *+

    Possessive match: like greedy but never backtracks (PCRE). Also ++, ?+.

Gruplar ve alternatifler

6
  • (abc)

    A capturing group; remembers the match for back-references and replacement.

    Örnek(ab)+ matches abab and captures ab
  • (?:abc)

    A non-capturing group: groups tokens without allocating a capture slot.

    Örnek(?:https?)://
  • (?<name>abc)

    A named capturing group, referenced later by its name.

    Örnek(?<year>\d{4})-(?<month>\d{2})
  • a|b

    Alternation: match the expression on the left OR the one on the right.

    Örnekcat|dog matches cat or dog
  • \1

    A back-reference: matches the same text the first capturing group matched.

    Örnek(['"]).*?\1 matches a quoted string
  • \k<name>

    A back-reference to a named capturing group.

    Örnek(?<q>['"]).*?\k<q>

Çevre denetimi

4
  • (?=abc)

    Positive lookahead: asserts what follows, without consuming it.

    Örnek\d+(?= USD) matches digits before USD
  • (?!abc)

    Negative lookahead: asserts that what follows is NOT the pattern.

    Örnekfoo(?!bar) matches foo not before bar
  • (?<=abc)

    Positive lookbehind: asserts what precedes, without consuming it.

    Örnek(?<=\$)\d+ matches digits after a $
  • (?<!abc)

    Negative lookbehind: asserts that what precedes is NOT the pattern.

    Örnek(?<!\d)\.\d+ matches a leading decimal

Bayraklar ve değiştiriciler

7
  • g

    Global: find all matches rather than stopping at the first.

    Örnek/a/g replaces every a
  • i

    Case-insensitive matching.

    Örnek/error/i matches Error and ERROR
  • m

    Multiline: ^ and $ match at the start and end of each line.

  • s

    Dotall (single line): . also matches newline characters.

  • u

    Unicode: treat the pattern as a sequence of Unicode code points.

    Örnek/\u{1F600}/u matches an emoji
  • y

    Sticky: match only from the regex's lastIndex position (JavaScript).

  • (?i)

    Inline flag: enable case-insensitivity from this point on (PCRE).

Yaygın kalıplar

8
  • ^[\w.+-]+@[\w-]+\.[\w.-]+$

    A pragmatic email address. Good enough for form validation, not RFC 5322.

    Örnekmatches [email protected]
  • ^https?:\/\/[^\s/$.?#].[^\s]*$

    A http(s) URL, requiring a scheme and a non-empty host.

    Örnekmatches https://example.com/path
  • ^(25[0-5]|2[0-4]\d|1?\d?\d)(\.(25[0-5]|2[0-4]\d|1?\d?\d)){3}$

    An IPv4 address with each octet bounded to 0-255.

    Örnekmatches 192.168.0.1
  • ^#?([\da-fA-F]{3}|[\da-fA-F]{6})$

    A 3- or 6-digit hexadecimal color, with an optional leading hash.

    Örnekmatches #1a2b3c and fff
  • ^\d{4}-\d{2}-\d{2}$

    An ISO-8601 calendar date (YYYY-MM-DD).

    Örnekmatches 2026-05-30
  • ^[a-z0-9]+(?:-[a-z0-9]+)*$

    A URL slug: lowercase words joined by single hyphens.

    Örnekmatches my-blog-post
  • ^\+?[1-9]\d{7,14}$

    An E.164 international phone number (digits with an optional leading +).

    Örnekmatches +14155552671
  • [0-9a-fA-F]{8}-(?:[0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}

    A UUID / GUID in its canonical 8-4-4-4-12 hyphenated form.

    Örnekmatches 550e8400-e29b-41d4-a716-446655440000

Bu hile sayfası hakkında

İfadeler, günlük eşleştirmenin büyük bölümünü kapsayan PCRE ve JavaScript (ECMAScript) sürümlerini izler. Motora özgü notlar açıklamalarda belirtilmiştir. Yaygın kalıplar, kapsamlı şartnameler değil, doğrulama düzeyinde pratik başlangıç noktalarıdır; bu yüzden yayına almadan önce kendi verilerinizle test edin.