ID EN
#Dynamic array

REGEXREPLACE

Excel Functions 🇮🇩 Bahasa Indonesia

Ganti teks dengan pola regex

Syntax

EXCEL
=REGEXREPLACE(text, pattern, replacement, [occurrence], [case_sensitivity])

Arguments

Parameter Deskripsi
text The text value to process.
pattern The pattern to replace.
replacement The text to replace with.
occurrence [optional] The instance to replace. Default = 0 = all instances.
case_sensitivity [optional] 0 = Case sensitive, 1= Case-insensitive. Default is 0.

Return Value

Kirim SMS setelah semua penggantian

Details

Fungsi REGEXREPLACE menggantikan teks yang cocok dengan pola regex tertentu dalam string teks tertentu. Anda dapat menganggap REGEXREPLACE sebagai versi yang jauh lebih kuat dari fungsi SUBSTITUTE yang sederhana. Meskipun kedua fungsi tersebut dapat digunakan untuk mencari dan mengganti string teks sederhana, REGEXREPLACE dapat menggunakan regex, bahasa canggih yang dibuat untuk mencocokkan dan memanipulasi nilai teks. Fungsi ini merupakan peningkatan besar pada fungsi teks Excel yang agak primitif. Untuk menggunakan REGEXREPLACE, berikan string teks, pola regex, dan teks pengganti. Misalnya, untuk mengganti "t" dengan "b" pada string teks "tuttle", Anda dapat menggunakan rumus seperti ini: Rumus tersebut menggantikan ketiga contoh "t" dengan "b". Perhatikan bahwa REGEXREPLACE peka huruf besar-kecil secara default. Jika kita menggunakan huruf "t" pertama, hanya huruf kedua dan th saja

Contoh

Example - Basic usage

To use REGEXREPLACE, provide a text string, a regex pattern, and the replacement text. For example, to replace "t" with "b" in the text string "tuttle

EXCEL
=REGEXREPLACE("tuttle","t","b") // returns "bubble"
Example - Basic usage

The formula replaces all three instances of "t" with "b". Note that REGEXREPLACE is case-sensitive by default. If we capitalize the first "t", only th

EXCEL
=REGEXREPLACE("Tuttle","t","b") // returns "Tubble"
Example - Basic usage

To disable case sensitivity, provide a 1 for the case-sensitive argument:

EXCEL
=REGEXREPLACE("Tuttle","t","b",,1) // returns "bubble"
Example - Basic usage

With case sensitivity disabled, all three "t"s are replaced with "b". Another way to replace both "T" and "t" with "b" is to include both in a regex c

EXCEL
=REGEXREPLACE("Tuttle","[Tt]","b") // returns "bubble"
Example - Strip non-numeric characters

The REGEXREPLACE function provides an easy way to remove non-numeric characters from a text string. You can see an example below, where REGEXREPLACE i

EXCEL
=REGEXREPLACE(B5,"[^0-9]","")
Example - capitalize first letter in text string

REGEXREPLACE can perform certain transformations, for example making text upper or lower case. You can see an example of how this works in the workshe

EXCEL
=REGEXREPLACE(B5,"^(.)","\U$1")

See Also

REGEXTEST REGEXEXTRACT SUBSTITUTE