GoLang
xxxxxxxxxx
package main
import (
"bytes"
"fmt"
"regexp"
)
func main() {
match, _ := regexp.MatchString("p([a-z]+)ch", "peach")
fmt.Println(match)
r, _ := regexp.Compile("p([a-z]+)ch")
fmt.Println(r.MatchString("peach"))
fmt.Println(r.FindString("peach punch"))
fmt.Println(r.FindStringIndex("peach punch"))
fmt.Println(r.FindStringSubmatch("peach punch"))
fmt.Println(r.FindStringSubmatchIndex("peach punch"))
fmt.Println(r.FindAllString("peach punch pinch", -1))
fmt.Println(r.FindAllStringSubmatchIndex(
"peach punch pinch", -1))
fmt.Println(r.FindAllString("peach punch pinch", 2))
fmt.Println(r.Match([]byte("peach")))
r = regexp.MustCompile("p([a-z]+)ch")
fmt.Println(r)
fmt.Println(r.ReplaceAllString("a peach", "<fruit>"))
in := []byte("a peach")
out := r.ReplaceAllFunc(in, bytes.ToUpper)
fmt.Println(string(out))
}
true true peach [0 5] [peach ea] [0 5 1 3] [peach punch pinch] [[0 5 1 3] [6 11 7 9] [12 17 13 15]] [peach punch] true p([a-z]+)ch a <fruit> a PEACH
Linux - كيفية تثبيت anc-api-tools
Linux - كيفية تثبيت curvedns
Linux - كيفية تثبيت zenmap
Python - تحقق مما إذا كان الرقم موجبًا أم سالبًا أم 0
C - عد عدد الأرقام في عدد صحيح
C - ابحث عن أكبر رقم باستخدام تخصيص الذاكرة الديناميكي
Python - كتابة ملفات إكسل (XLSX)
C++ - تحقق مما إذا كان الرقم أوليًا أم لا
Kotlin - عكس رقم
Kotlin - أوجد عاملي العدد
JavaScript - تحقق مما إذا كانت السلسلة تبدأ وتنتهي بأحرف معينة
Linux - كيفية تثبيت zstd
Linux - كيفية تثبيت xbitmaps
C++ - البحث عن الحاصل والباقي
Python - فقاعة الفرز
Java - عكس رقم
Kotlin - تقريب رقم إلى n منازل عشرية
C++ - تحقق من السنة الكبيسة
We have been online since 2021 and 1 millions of people around the globe have visited our website since then
More visitors every month