Regex: Grupuri si Cuantificatori

Stefanescu Mihai 3 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 vorbesc despre grupuri si cum putem selecta sau omite un asemenea grup.
Hai sa facem un regex ce va selecta o adresa de email. In primul rand dorim sa selectam tot ce este inainte de @, deci o sa cautam toate caracterele alfa-numerice si underscore:

[A-Za-z0-9_]

Apoi avem nevoie de un @ pe care-l selectam folosind

+@

Apoi pentru provider avem inca o data un set de carcatere alfanumeric + cratima (aici puteti orice alte caractere doriti sa fie acceptate):

[A-Za-z0-9-]

Iar acum pentru domeniu am putea pune (.*) sau alt grup alfa numeric [A-Za-z0-9], dar aici avem urmatoarea problema, daca un utilizator pune un domeniu precum .sd87sdfasah acesta va fi acceptat, deci trebuie sa facem un grup in felul urmator (si aici puteti pune si alte domenii, dar trebuie sa fie separate de operatorul | ):

(ro|org|com)

Cuantificatori

Am facut o lista de cuvinte cu care sa lucram mai departe:

invata programare
salut
expresie

Acum probabil cu totii stim cum sa selectam un cuvant, folosim [a-z]+, dar ce facem cand dorim sa selectam doar cuvintele care sunt formate din 5 litere?
Pai putem face urmatorul lucru:

Se poate observa ca au fost selectate primele 5 litere din fiecare cuvant. Acoladele, ca in exemplul de mai sus, de permit sa specificam si un interval in care sa se afle textul dorit, de exemplu:

Folosind aceleasi acolade putem cauta cuvinte cu un numar de litere mai mare decat un anumit numar stabilit de noi:

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

tretinoin disponible en Brasil # 4 months ago Helpful info. Lucky me I discovered your website unintentionally, and I am shocked why this accident didn't took place in advance! I bookmarked it.
eskazole en vente en Espagne # 4 months ago Thank you for sharing your info. I truly appreciate your efforts and I am waiting for your further post thank you once again.
Kngeno # 3 months ago order tricor 160mg sale <a href="https://fenoficor.com/">fenofibrate 160mg brand</a> buy fenofibrate paypal
Dyngtw # 3 months ago zaditor over the counter <a href="https://tofobose.com/">brand imipramine 75mg</a> pill imipramine
Uwthyr # 3 months ago minoxytop tablet <a href="https://edxgetonline.shop/">over the counter ed pills that work</a> red ed pill
Jaxova # 3 months ago buy precose 50mg generic <a href="https://micronide.shop/">buy generic prandin 2mg</a> generic griseofulvin
Ovjuwc # 3 months ago order aspirin 75 mg <a href="https://aminirin.shop/">order aspirin pills</a> imiquimod cream
Hosea # 3 months ago Woah! I'm really loving the template/theme of this website. It's simple, yet effective. A lot of times it's hard to get that "perfect balance" between usability and visual appeal. I must say you've done a awesome job with this. Additionally, the blog loads super fast for me on Firefox. Outstanding Blog!
Gzpsdo # 3 months ago buy generic dydrogesterone over the counter <a href="https://danaterone.shop/">purchase duphaston</a> cheap empagliflozin 10mg
Ofmord # 3 months ago florinef generic <a href="https://acipolax.shop/">order dulcolax 5 mg online</a> buy imodium 2mg generic
Itdooy # 3 months ago etodolac 600mg generic <a href="https://colotazol.shop/">generic cilostazol 100 mg</a> cilostazol 100 mg canada
Owvkec # 3 months ago buy generic prasugrel 10mg <a href="https://imocarbam.shop/">order prasugrel for sale</a> where to buy detrol without a prescription
Qzqtqg # 3 months ago order ferrous sulfate generic <a href="https://betaotec.com/">order betapace 40mg online</a> sotalol canada
Kqrzel # 3 months ago purchase mestinon for sale <a href="https://mestien.shop/">piroxicam uk</a> buy rizatriptan 10mg online cheap
Sdkdqb # 2 months ago buy xalatan eye drop <a href="https://aexeloda.com/">buy xeloda 500mg generic</a> rivastigmine generic
Hoydmk # 2 months ago betahistine generic <a href="https://haloatan.com/">where to buy haloperidol without a prescription</a> purchase benemid
Bcvlfo # 2 months ago telmisartan oral <a href="https://molnenil.com/">buy hydroxychloroquine 400mg</a> molnunat order
Yzumte # 2 months ago buy generic cenforce 50mg <a href="https://chlodinir.com/">buy aralen generic</a> where to buy chloroquine without a prescription
Dhxixx # 2 months ago real online blackjack <a href="https://furocheap.com/">generic furosemide</a> oral furosemide 40mg
Vryiuq # 2 months ago slot online <a href="https://doxtoponline.online/">online casinos usa</a> where can i buy albuterol
Nbshpz # 2 months ago online blackjack for real money usa <a href="https://strvnonline.com/">buy stromectol paypal</a> ivermectin 1 cream
Jweagi # 2 months ago symmetrel uk <a href="https://metometrel.shop/">where can i buy amantadine</a> aczone 100mg brand
Rcqdzj # 2 months ago buy generic methylprednisolone <a href="https://medipirol.shop/">buy generic nifedipine over the counter</a> triamcinolone sale
Nxkwny # 2 months ago serophene oral <a href="https://azatophene.com/">clomid usa</a> order imuran 25mg
Vbxwgb # 2 months ago buy cheap generic aceon <a href="https://arisceon.shop/">coversum online</a> order fexofenadine 180mg generic
Kcgeyv # 1 month ago buy phenytoin online <a href="https://cycopan.shop/">buy oxybutynin for sale</a> buy oxybutynin
Revkxx # 1 month ago purchase baclofen sale <a href="https://bactyline.shop/">elavil 50mg ca</a> buy ketorolac paypal
Jgxkxb # 1 month ago glimepiride 4mg without prescription <a href="https://arcotecgn.com/">buy cytotec for sale</a> etoricoxib drug
Evvoez # 1 month ago oral alendronate 35mg <a href="https://macroicine.com/">order colchicine without prescription</a> order furadantin pill
Jghyla # 1 month ago order inderal pill <a href="https://propofen.com/">buy inderal 20mg for sale</a> buy clopidogrel for sale
Ydjwes # 1 month ago nortriptyline for sale online <a href="https://meloceto.com/">methotrexate 10mg drug</a> buy acetaminophen 500 mg online
Vlreub # 1 month ago buy cheap generic medex <a href="https://wafetine.com/">order medex</a> metoclopramide 20mg brand
Eiiduz # 1 month ago famotidine 40mg for sale <a href="https://cozolimus.shop/">prograf 5mg pill</a> prograf 5mg brand
Hzksqb # 1 month ago oral astelin 10 ml <a href="https://diltastel.shop/">astelin for sale online</a> irbesartan 300mg brand
Itpfrr # 1 month ago buy zyloprim 300mg online cheap <a href="https://rosuirone.com/">crestor 10mg price</a> buy rosuvastatin pills
Nbdarb # 1 month ago buy imitrex <a href="https://aleoflox.com/">order levofloxacin 250mg sale</a> order dutasteride sale
Zjfvwd # 1 month ago order buspirone 10mg generic <a href="https://rosuirone.shop/">purchase buspin pill</a> purchase amiodarone
Jcufui # 1 month ago domperidone price <a href="https://sumentin.com/">buy generic sumycin</a> order tetracycline 500mg online
Knrlsi # 1 month ago tamsulosin 0.2mg us <a href="https://apflosin.com/">cost tamsulosin 0.4mg</a> buy simvastatin 10mg online
Vjlryz # 1 month ago letter writing services <a href="https://essayawonline.com/">essay writing assistance</a> essay helper online
Gixpwb # 1 month ago aldactone 100mg cheap <a href="https://firidepro.com/">order finasteride for sale</a> buy proscar 5mg online
Zfoamp # 1 month ago purchase aurogra generic <a href="https://auroafil.com/">sildenafil without prescription</a> estradiol pills
Cyyimi # 1 month ago diflucan for sale <a href="https://diorcatm.com/">fluconazole 100mg pill</a> buy cipro for sale
Hzcdas # 4 weeks ago order generic lamotrigine 200mg <a href="https://prazres.com/">order minipress 2mg generic</a> oral vermox
Ffjuoh # 3 weeks ago order cleocin 150mg pills <a href="https://aperytxpro.com/">cheap erythromycin 250mg</a> fildena 100mg generic
Ghrkgm # 3 weeks ago buy generic tretinoin <a href="https://abvatol.com/">brand stendra</a> buy stendra generic
Cqmwph # 3 weeks ago order tamoxifen 20mg generic <a href="https://batanine.com/">buy betahistine 16mg online cheap</a> budesonide generic
Xhvarm # 3 weeks ago tadacip 10mg cheap <a href="https://btadonline.com/">tadacip 10mg brand</a> indomethacin online order
Lppctj # 3 weeks ago ceftin 250mg pills <a href="https://cefetil.com/">cefuroxime 500mg sale</a> buy methocarbamol 500mg pills
Lovsjh # 2 weeks ago buy aspirin <a href="https://msgameonline.com/">best online casinos</a> blackjack online betting
Gavihr # 2 weeks ago buying a research paper <a href="https://cepraol.com/">order generic suprax 100mg</a> cefixime 100mg uk
Rpkxqj # 2 weeks ago trimox uk <a href="https://arimlanas.com/">anastrozole 1mg tablet</a> purchase clarithromycin
Wvgtcw # 2 weeks ago brand calcitriol <a href="https://triprefibran.com/">order tricor 200mg online</a> buy fenofibrate
Pnjsoy # 2 weeks ago clonidine drug <a href="https://mecanpres.com/">order meclizine 25 mg generic</a> buy spiriva 9 mcg for sale
Zwyqjf # 2 weeks ago antibiotics for pimple pills <a href="https://placnemedx.com/">best acne treatment for boys</a> order oxcarbazepine pill
Rjispu # 1 week ago purchase minocycline online <a href="https://aminecycl.com/">minocin without prescription</a> order requip generic
Gpkhjh # 1 week ago buy uroxatral generic <a href="https://antiaciditytrt.com/">heartburn tablets prescription</a> list of anti nausea medications
Fcsajj # 1 week ago best sleep aids for seniors <a href="https://urupdiol.com/">strong sleeping pills for sale</a> approved weight loss injections
Deqywf # 1 week ago provera 5mg sale <a href="https://microchloroth.com/">microzide cost</a> order hydrochlorothiazide without prescription
Dxtdkp # 1 week ago nicotine medication for quitting tobacco <a href="https://healthybonesots.com/">medication for severe bone pain</a> free pain pills online
Qxdouj # 1 week ago cyproheptadine 4 mg without prescription <a href="https://peritadin.com/">oral cyproheptadine</a> ketoconazole 200mg uk
Vwgvho # 1 week ago buy antiviral pills <a href="https://bsasthmaps.com/">daily asthma inhaler brand names</a> help with diabetic drug cost
Feacyr # 6 days ago fungal nail tablets <a href="https://rebloodpressure.com/">losartan side effects in elderly</a> blood pressure medication steps
Ttdzxw # 4 days ago how long for gastritis recovery <a href="https://aheartop.com/">antiarrhythmic agents list</a> best over counter uti medicine
Dpdxtr # 4 days ago order phenergan pills <a href="https://prohnrg.com/">buy phenergan generic</a> stromectol usa
Eueotk # 3 days ago order birth control shot online <a href="https://awomenahealthp.com/">birth control prescription refill</a> pills for semen volume
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.