Nome Utente: 
Password : 
Restringi sessione all'IP 
Online in 1gg

Level4 again  Vai alla sfida "Training: Regex"

Posizione globale: 4431
Punteggio totale: 4346
Posts : 10
Grazie: 6
Voti+: 7
Registrato: 13a 237gg
Avatar di fuzzy
Ultima visita: 10a 202gg
L'utente è Offline
Level4 again
Google/traduci0Grazie!0Bel post!0Brutto post! Link
/^wechall4?(?=\.(jpg|gif|tiff|bmp|png)$)/


Can you help me find why this regex is incorrect?
Are there any incorrect cases which can bypass it?

I've tested it and it captures only filename (with or without 4) and only with specified extension.

Thanks for help! Smile
Posizione globale: 8107
Punteggio totale: 1267
Posts : 2
Grazie: 2
Voti+: 2
Registrato: 13a 243gg
Ultima visita: 10a 348gg
L'utente è Offline
RE: Level4 again
Google/traduci1Grazie!1Bel post!0Brutto post! Link
It doesn't capture filename, it matches filename and extension and additionally captures extension without the dot. You must to capture filename and only filename.

Edit.
Seems that you tested it wrong. ;)
Ultima modifica: pskosinski - 14 Mar 2013 - 00:12:29
Posizione globale: 566
Punteggio totale: 46996
Posts : 37
Grazie: 21
Voti+: 24
Registrato: 14a 26gg
Avatar di stormsurfer



Ultima visita: 9a 136gg
L'utente è Offline
RE: Level4 again
Google/traduci0Grazie!2Bel post!0Brutto post! Link
what do you mean capture? what is the differenct between capture and matches?
Posizione globale: 814
Punteggio totale: 33093
Posts : 9
Grazie: 7
Voti+: 6
Registrato: 14a 151gg
Ultima visita: 12a 306gg
L'utente è Offline
RE: Level4 again
Google/traduci2Grazie!2Bel post!0Brutto post! Link
i see two problems whith your regex:
- you have two groups. one should be enough...
- how do you start a non-capturing group? hint: it's not ?=

capturing is done using capturing groups. that means if a string matches the pattern, then parts of that string can be captured using capturing groups...
Posizione globale: 4431
Punteggio totale: 4346
Posts : 10
Grazie: 6
Voti+: 7
Registrato: 13a 237gg
Avatar di fuzzy
Ultima visita: 10a 202gg
L'utente è Offline
RE: Level4 again
Google/traduci1Grazie!1Bel post!0Brutto post! Link
Finally completed this task. Thanks for help guys! Smile
Posizione globale: 14815
Punteggio totale: 158
Posts : 1
Grazie: 0
Voti+: 0
Registrato: 9a 138gg
Ultima visita: 7a 361gg
L'utente è Offline
RE: Level4 again
Google/traduci0Grazie!0Bel post!0Brutto post! Link
Citazione da sutupud
14 Mar 2013 - 01:29:32

i see two problems whith your regex:
- you have two groups. one should be enough...
- how do you start a non-capturing group? hint: it's not ?=

capturing is done using capturing groups. that means if a string matches the pattern, then parts of that string can be captured using capturing groups...


Why isn't it "?="?
My regex works fine on online demos, but I can't just get it to work on this challenge
"?:" Doesn't seem to have any effect on those demos
Redknee, AIHAPPLE, zhukeni, alibaba2024, silenttrack, n0tHappy, nonfungiblesecurity, stormsurfer, quangntenemy, TheHiveMind, Z, balicocat, Ge0, arraez, jcquinterov, hophuocthinh, alfamen2, burhanudinn123, Ben_Dover, stephanduran89, braddie0, fpombal, csuquvq utenti hanno sottoscritto il thread e ricevo le E-Mail di notifica.
1 persone stanno visualizzando il thread.
Questo thread è stato visualizzato 10458 volte.

PHP Fatal Error(1): Constant E_STRICT is deprecated since 8.4, the error level was removed in www/protected/config.php line 6


Backtrace starts in [unknown file] line ?. GWF_Debug::shutdown_function() core/inc/util/GWF_Debug.php line 109. GWF_Debug::error_handler().... core/inc/util/GWF_Debug.php line 180.