Regex: Caractere ce se repeta si Cuvinte din aceasi familie

Stefanescu Mihai 2 years ago Regular Expressions
Acest articol face parte din cursul Toate lectiile Regular Expressions. Te poti inscrie la acest curs aici!

In acest articol am sa presupun ca dorim sa cautam un cuvant in care poate varia o anumita litera, sa luam exemplul de mai jos:


Ce putem face pentru a selecta toate aceste versiuni ale cuvantului?
Putem face un regex care va cauta cuvantul initial si-l va gasi chiar daca o anumita litera se repeta de mai multe ori:

Destul de simplu, nu? Hai sa va invat cum sa faceti acest lucru intr-un mod si mai simplu. Trebuie doar sa adaugati un + dupa caracterul ce este posibil sa se repete de mai multe ori:

Cuvinte din aceasi familie

Acum am sa va vorbesc despre gasirea cuvintelor cu aceasi radacina.
Pentru inceput trebuie sa luam o familie de cuvinte cu aceasi radacina:


Se poate observa foarte simplu ca radacina este invat, din care vin derivatele invatam si invatasem.
In acest caz, ca si in cazul de mai sus putem face acest lucru in 2 moduri:
Putem cauta radacina urmata de orice alte 0 sau mai multe caractere:


Sau putem cauta radacina urmata de una dintre terminatiile dorite:


Programator de ~8 ani, am lucrat la proiecte din mai multe industrstrii, de la eCommerce la telecomunicatii la automatizari. In acest timp am folosi diferite tehnologii, de la PHP, MySQL, PostgreSql, RabbitMq, Redis, Memcached si altele.

Get in touch
Pentru nelamuriri, dubii, comentarii si chestii de pe suflet ne putem auzi pe Discord, Reddit sau poti deschide o discutie noua pe forum

Bitch # 1 month ago Hello there! This postt couldn't be written anny better! Gokng through this post reminds me of myy previous roommate! He aalways ket taking bout this. I'll forward this article to him. Pretty sure he'll have a verey gokod read. Maany thankks for sharing!
Who is she?pls help_me # 1 month ago I wass recommended this web site throuh myy cousin. I'm now nnot cedtain whether this publish iss written by means of himm as nobody else realjze such detailed approximately myy difficulty. Youu are incredible! Thank you!
Video x?c minh # 1 month ago Helllo woould you mnd letting mee know which hosting company you're working with? I've loased your blg in 3 digferent browsers and I mjst say this blog loasds a lott quicker then most. Can you recommend a good hosting provider aat a reasonable price? Many thanks, I appreciate it! # 1 month ago alll thhe ttime i used too read smaller content that also lear their motive, and that iis also happening with this piece of writing which I am reading att this place.
756 # 1 month ago Verry shortly this web page woll be famous amng all blopg people, duee too it's good posts
601 # 1 month ago Your means of descrtibing everything in this paraagraph iis acttually fastidious, every oone be capable of easily understand it, Thanks a lot.
813 # 4 weeks ago Fantastic items from you, man. I have keep inn mind you stuff previous to and you aare juszt extremely fantastic.I eally like what yoou habe received right here, certainly like wht you're stqting and thhe way byy which yyou asert it. You're making it enjoyable and youu continue tto care for too stay iit sensible. I caan nott wait to learn far more from you. That iis rally a wonderful website.
991 # 3 weeks ago I am extremely impresssed wirh your writing ailities as well as wioth the sructure foor your blog. Is tgat this a paid subjeect matter or did you custokmize iit yourself? Anyway eep uup thhe excelleent quality writing, itt is rrare to look a grea weblog like thjs onne today.. # 3 weeks ago I have ben explorfing forr a bit for any high-quality articles oor weblog posts on thi sort oof space . Exploring iin Yahoo I finally syumbled upoon thks site. Readingg this information So i'm satisfied to exhibit thazt I have a very excellent uncanny feeling I came upon just what I needed. I most indiputably wil mae sure to don?t put out oof your mind this webzite aand providess iit a look onn a reelentless basis.
094 # 3 weeks ago Incredible quwst there. What occurred after? Thanks!
Club-ul este dedicat membrilor si ofera access la mai multe zone ale website-ului.
Login Register

๐Ÿ”– Bookmarks โž•
โœจ Pentru a sustine aceasta comunitate am sa te rog sa te autentifici sau sa te inregistrezi!

๐ŸŒช๏ธ Discord โž•
Back to top
Folosim cookie-uri pentru a oferi functionalitatile critice ale aplicatiei Invata-Programare. Folosim cookie-uri si pentru a analiza traficul, pentru care e nevoie de consimtamantul dvs. explicit.