Jump to content
Che

[REGEX] Nume cu anumite caracteristici

Recommended Posts

Posted (edited)

La aceasta pagina de aici:

https://ro.wikipedia.org/wiki/List%C4%83_de_nume_rom%C3%A2ne%C8%99ti_-_litera_S

As vrea, care se pricepe, sa-mi scrie o expresie regex care sa-mi selecteze doar acele nume care au TOATE aceste caracteristici:

1. Incep cu S si se termina in n sau c.

2. Contin obligatoriu litera n, litera a si litera l (adica L, nu i).

3. Nu au mai mult de 10 litere.

4. Nu contine g, j, x, k, z, y, w, q.

Multumesc anticipat !

Edited by Che
Posted

Input:

Sa

Saba (wikt)

Sabadac (wikt)

Sabada? (wikt)

Sabadî? (wikt)

Sabado? (wikt)

Sab?u (wikt)

Sabcu (wikt)

Sabie (wikt)

Sabin (wikt)

Sabinevschi (wikt)

Sabloschi (wikt)

Sabo (wikt)

Sabou (wikt)

Sabu (wikt)

Sabuc (wikt)

Sacaci (wikt)

Sacaliu (wikt)

Sacaliuc (wikt)

Sacalo? (wikt)

Sacazof (wikt)

Sacerdo?eanu (wikt)

Sachelari (wikt)

Sachelarie (wikt)

Sachin (wikt)

Sacot? (wikt)

Saculea (wikt)

Sadagurschi (wikt)

Sadica (wikt)

Sadici (wikt)

Sadiu (wikt)

Sadovac (wikt)

Sadovan (wikt)

Sadoveac (wikt)

Sadoveanu (wikt)

Sadovei (wikt)

Sadovinschi (wikt)

Saegiu (wikt)

Safalichi (wikt)

Safca (wikt)

Safcencu (wikt)

Safer (wikt)

Safir (wikt)

Safirescu (wikt)

Safriuc (wikt)

Safta (wikt)

Ce am reusit sa fac:

S\w+[^gjxkzywq(wikt)]

daca ii adaug n\b imi da doar Sadovan si mai sunt si altelke terminate in n in lista, un alt exemplu fiind Sabin.

Cum fac sa fie terminat ori in n, ori in c ?

Plus,

2. Contin obligatoriu litera n, litera a si litera l (adica L, nu i).

3. Nu au mai mult de 10 litere. (intre 5 si 10 litere).

Posted (edited)
La aceasta pagina de aici:

https://ro.wikipedia.org/wiki/List%C4%83_de_nume_rom%C3%A2ne%C8%99ti_-_litera_S

As vrea, care se pricepe, sa-mi scrie o expresie regex care sa-mi selecteze doar acele nume care au TOATE aceste caracteristici:

1. Incep cu S si se termina in n sau c.

2. Contin obligatoriu litera n, litera a si litera l (adica L, nu i).

3. Nu au mai mult de 10 litere.

4. Nu contine g, j, x, k, z, y, w, q.

Multumesc anticipat !

Încearc? expresia asta:


\bS(?=.*a)(?=.*n)(?=.*l)[^gjxkzywq]{0,8}[nc]\b

PS:

Nume g?site:


Salamon (wikt)
Salatan (wikt)
Salenciuc (wikt)
Salmen (wikt)
Sarafolean (wikt)
.......

Edited by H3xoR
Posted
Încearc? expresia asta:


\bS(?=.*a)(?=.*n)(?=.*l)[^gjxkzywq]{0,8}[nc]\b

PS:

Nume g?site:


Salamon (wikt)
Salatan (wikt)
Salenciuc (wikt)
Salmen (wikt)
Sarafolean (wikt)
.......

Vad ca nu merge expresia. Unde ai testat-o ? Pe ce limbaj ? Javascript, pcre, php ? Am incercat si online si tot nu merge.

Posted (edited)
Vad ca nu merge expresia. Unde ai testat-o ? Pe ce limbaj ? Javascript, pcre, php ? Am incercat si online si tot nu merge.

De testat, am testat-o aici: https://regex101.com/r/eC5iD0/1

Ce limbaj? Toate limbajele care au implementat o versiune de Regex folosind ECMAScript syntax (JS/C++0x/..) sau PCRE (Perl/PHP/..).

2ik4ab5.png

PS:

Din lista aia de pe wikipedia, am extras urmatoarele nume:


[
"Salamon",
"Salan",
"Salatan",
"Salenciuc",
"Salmen",
"Sarafolean",
"Sburlan",
"Sculean",
"Secelean",
"Selcudean",
"Seleu?an",
"Sele?an",
"Sele?tean",
"Seliman",
"Selincean",
"Seli?can",
"Seli?tean",
"Selnicean",
"Seplecan",
"Setelecan",
"Sâlhan",
"Sâmp?lean",
"Sâncelean",
"Sânp?lean",
"S?celean",
"S?c?lean",
"S?hlean",
"S?lan",
"S?lban",
"S?lciuan",
"S?lcudean",
"S?lcu?an",
"S?li?can",
"S?li?tan",
"S?li?tean",
"S?lvan",
"S?l?tioan",
"S?l??an",
"S?nduleac",
"S?ndulean",
"S?pl?can"
]

Edited by H3xoR

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...