Креирај НалогСакри Sidebar
Корисничко Име: 
Шифра: 
Ограничи сесију за IP 
Најбољих 10 Корисника

Level 3  Go to the Training: Regex challenge

1 2
Глобални Ранг: 13742
Коначни резултат: 194
Posts: 5
Thanks: 10
UpVotes: 11
Registered: 13y 90d
Last Seen: 13y 84d
The User is Offline
Level 3
Google/translate2Thank You!2Good Post!0Bad Post! link
I'm sorry for posting so much, but I just can't seem to understand why my answer is being rejected in level 3.

This is the assignment:
Your pattern shall match all images with the name wechall.ext or wechall4.ext and a valid image extension.
Valid image extensions are .jpg, .gif, .tiff, .bmp and .png.

And I get this error:
Your pattern would match "wechall.jpg ", but it should not match it.

But from the explanation it seems to me that it should match it. Could someone explain this to me?
Глобални Ранг: 194
Коначни резултат: 107304
Posts: 1701
Thanks: 1367
UpVotes: 931
Registered: 17y 100d




Last Seen: 7d 17h
The User is Offline
RE: Level 3
Google/translate1Thank You!0Good Post!1Bad Post! link
The challenge also checks against "wechall.jpg "
Note the whitespace at the end of this checked filename.

Cheers
gizmore
The geeks shall inherit the properties and methods of object earth.
Глобални Ранг: 13742
Коначни резултат: 194
Posts: 5
Thanks: 10
UpVotes: 11
Registered: 13y 90d
Last Seen: 13y 84d
The User is Offline
RE: Level 3
Google/translate2Thank You!2Good Post!0Bad Post! link
Thanks
Глобални Ранг: 12454
Коначни резултат: 320
Posts: 2
Thanks: 0
UpVotes: 0
Registered: 12y 313d
Last Seen: 12y 302d
The User is Offline
RE: Level 3
Google/translate0Thank You!0Good Post!0Bad Post! link
Hi,

i'm getting reject with "Your pattern would match "wechall3.png", but it should not match it."
But my regex only allows no numbers or a 4.. i have no idea how the check can come up with a 3 allowed?! Every RegEx tests like RegEx Coach / other online Tests said it will not recognize wechall3.png..

I don't want to to post the almost complete RegEx here and i cannot sent PMs yet. But basically what i do is check for "wechall" followed by number and the "possible" operator, followed by . extension..

Does anyone knows whats going on?
Глобални Ранг: 194
Коначни резултат: 107304
Posts: 1701
Thanks: 1367
UpVotes: 931
Registered: 17y 100d




Last Seen: 7d 17h
The User is Offline
RE: Level 3
Google/translate0Thank You!0Good Post!0Bad Post! link
It shall only match wechall4 and wechall, but not wechall3 ... maybe that`s the problem?
Another thing might be that . means any char, so you maybe want to escape it like \.

Maybe it helps
gizmore
The geeks shall inherit the properties and methods of object earth.
Глобални Ранг: 12454
Коначни резултат: 320
Posts: 2
Thanks: 0
UpVotes: 0
Registered: 12y 313d
Last Seen: 12y 302d
The User is Offline
RE: Level 3
Google/translate0Thank You!0Good Post!0Bad Post! link
It only checks vs the explicit 4. Not any number. Also i tried . oder \. - its no difference
Глобални Ранг: 6391
Коначни резултат: 2026
Posts: 5
Thanks: 4
UpVotes: 4
Registered: 14y 148d
Last Seen: 4y 340d
The User is Offline
RE: Level 3
Google/translate0Thank You!0Good Post!0Bad Post! link
Hello challengers.
code(bmp|png|jpg|tiff|gif)
will show:
Quote from Unknown
Your pattern would capture a string, but this is not wanted. Please use a non capturing group.

How can i pass that without () grouping?

Can you give me a link or hint for?
greets grmf.
Глобални Ранг: 194
Коначни резултат: 107304
Posts: 1701
Thanks: 1367
UpVotes: 931
Registered: 17y 100d




Last Seen: 7d 17h
The User is Offline
RE: Level 3
Google/translate4Thank You!3Good Post!0Bad Post! link
use a non capturing group (?:group|here)
The geeks shall inherit the properties and methods of object earth.
Глобални Ранг: 6391
Коначни резултат: 2026
Posts: 5
Thanks: 4
UpVotes: 4
Registered: 14y 148d
Last Seen: 4y 340d
The User is Offline
RE: Level 3
Google/translate0Thank You!1Good Post!0Bad Post! link
Quote from Unknown
Correct, let`s see if you can come up with a pattern for the next problem.

Thank you! i have searched since hours but not seen that hint.
Глобални Ранг: 195
Коначни резултат: 107303
Posts: 14
Thanks: 12
UpVotes: 7
Registered: 12y 278d



The User is Offline
RE: Level 3
Google/translate2Thank You!1Good Post!0Bad Post! link
Here you have the definition (and difference between others) of non capturing group.
http://www.regular-expressions.info/refadv.html
Regards.
1 2
sisyang, Redknee, AIHAPPLE, zhukeni, alibaba2024, tunelko, silenttrack, n0tHappy, nonfungiblesecurity, quangntenemy, TheHiveMind, Z, balicocat, Ge0, samuraiblanco, arraez, jcquinterov, hophuocthinh, alfamen2, burhanudinn123, Ben_Dover, stephanduran89, braddie0, SwolloW, dangarbri, csuquvq 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 77814 times.