Nom d'utilisateur: 
Mot de passe: 
Restreindre la session à cette IP 

Level4 again  Go to the Training: Regex challenge

Classement Général: 4139
Total de Points: 4381
Posts: 10
Thanks: 6
UpVotes: 7
Registered: 11y 51d
Avatar de fuzzy
Last Seen: 8y 16d
The User is Offline
Level4 again
Google/translate0Thank You!0Good Post!0Bad 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
Classement Général: 7525
Total de Points: 1245
Posts: 2
Thanks: 2
UpVotes: 2
Registered: 11y 58d
Last Seen: 8y 163d
The User is Offline
RE: Level4 again
Google/translate1Thank You!1Good Post!0Bad 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. ;)
Last edited by pskosinski - Mars 14, 2013 - 00:12:29
Classement Général: 537
Total de Points: 47146
Posts: 37
Thanks: 21
UpVotes: 24
Registered: 11y 205d
Avatar de stormsurfer



Last Seen: 6y 316d
The User is Offline
RE: Level4 again
Google/translate0Thank You!2Good Post!0Bad Post! link
what do you mean capture? what is the differenct between capture and matches?
Classement Général: 751
Total de Points: 33876
Posts: 9
Thanks: 7
UpVotes: 6
Registered: 11y 330d
Last Seen: 10y 121d
The User is Offline
RE: Level4 again
Google/translate2Thank You!2Good Post!0Bad 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...
Classement Général: 4139
Total de Points: 4381
Posts: 10
Thanks: 6
UpVotes: 7
Registered: 11y 51d
Avatar de fuzzy
Last Seen: 8y 16d
The User is Offline
RE: Level4 again
Google/translate1Thank You!1Good Post!0Bad Post! link
Finally completed this task. Thanks for help guys! Smile
Classement Général: 13717
Total de Points: 151
Posts: 1
Thanks: 0
UpVotes: 0
Registered: 6y 318d
Last Seen: 5y 176d
The User is Offline
RE: Level4 again
Google/translate0Thank You!0Good Post!0Bad Post! link
Quote from sutupud
Mars 14, 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, tunelko, silenttrack, n0tHappy, stormsurfer, quangntenemy, TheHiveMind, Z, balicocat, Ge0, samuraiblanco, arraez, jcquinterov, hophuocthinh, alfamen2, burhanudinn123, Ben_Dover, stephanduran89, braddie0, JanLitwin17, SwolloW, dangarbri have subscribed to this thread and receive emails on new posts.
1 people are watching the thread at the moment.
This thread has been viewed 9123 times.