# string.match

- **Ortam:** İstemci, Sunucu, Menü
- **İngilizce aslı:** https://wiki.facepunch.com/gmod/string.match
- **Çeviri tarihi:** 2025-09-08

```lua
vararg string.match( string string, string pattern, number startPosition = 1 )
```

## Açıklama

Bir string içinde bir [Desen](https://gmod.tr/wiki/Patterns) bulur.

## Argümanlar

1. [string](https://gmod.tr/wiki/string) **string**: İçinde eşleşme aranacak olan string.
2. [string](https://gmod.tr/wiki/string) **pattern**: Neyin eşleştirileceğini tanımlayan desen.
3. [number](https://gmod.tr/wiki/number) **startPosition** = 1: Eşleştirmenin başlayacağı başlangıç indeksi, sondan göreceli bir konumdan eşleştirmeyi başlatmak için negatif olabilir.

## Döndürülenler

1. [vararg](https://gmod.tr/wiki/vararg): Eşleşen metin(ler)

### Örnek

```lua
local toMatch = "this is a sample text"
print( string.match( toMatch, "sample" ) )
-- desenler çalışır
print( string.match( toMatch, "^[a-z]" ) )
print( string.match( toMatch, "^this" ) )
print( string.match( toMatch, "^..is" ) )
print( string.match( toMatch, "text$" ) )
-- tüm string
print( string.match( toMatch, "^.*$" ) )
-- çoklu dönüş değerleri
print( string.match( toMatch, "(this) is a (%w+)" ) )
-- nil
print( string.match( toMatch, "this$" ) )
print( string.match( toMatch, "nil" ) )
```

**Çıktı:**

```lua
sample
t
this
this
text
this is a sample text
this	sample
nil
nil
```

- [GMod Wiki ana sayfası](https://gmod.tr/wiki)

---

[Tüm sunucular](https://gmod.tr/) · [GmodTR Launcher](https://gmod.tr/launcher) · [Rehber](https://gmod.tr/rehber) · [GMod Wiki](https://gmod.tr/wiki) · [GmodTR nedir?](https://gmod.tr/hakkinda) · [Sunucu ekle](https://gmod.tr/sunucu-ekle) · [Discord](https://discord.gg/gmodtr)

Kaynak: https://gmod.tr/wiki/string.match
