[Challenge] - Regex

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

[Challenge] - Regex

Post by klevis miho »

Perform a regex on this text:
- newsletter
- good news letter
- NEWS 1
- letter (number on. 599)
- NE 1 K.A.R. - 777
- the first things (number on. 760) - 777
- things happen 6 - 777 - 778
- room - is anyone there - to get things going
- walk of life - preventing marry - showing more than got - 777
- preliminaryt status - bud & spencer: the returning (page on. 528) - 777 - 778

The output should be:
newsletter
good news letter
NEWS 1
letter
NE 1 K.A.R.
the first things
things happen 6
room - is anyone there - to get things going
walk of life - preventing marry - showing more than got
preliminaryt status - bud & spencer: the returning

:D
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: [Challenge] - Regex

Post by josh »

1) you write this as a challenge but dont elaborate, or even quantify what it is we are being challenged on, other then to simply do your homework
2) you dont provide any additional information about the significance of the "1" vs the insignificance of matching the "6", should it just not match any "1"s? Or is it because that number is odd? etc... So even if someone was to take the "challenge" you wrote a spec that sets our pattern up for failure.

Another one of your exciting "challanges" - viewtopic.php?f=1&t=105200

Sounds fun. Doing stuff for you while you cheekishly refuse to acknowledge it, just how I want to spend my weekend :D . This doesn't seem like a "challenge" or "puzzle" at all.

Since it is not clear what a continuation of your "pattern" would look like, any potential solution would just be a mechanical altering of your original pattern, granted it does take some knowledge of regex to complete I think there should be some wit involved, maybe you could do that by posting the "rules" of your pattern and see who can come up with the shortest solution ( anyone could simply copy and paste each one of those lines and simply black or white list it respectively)
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Re: [Challenge] - Regex

Post by klevis miho »

I don't know what you mean, maybe my english isn't good.
I simply do what a regular expression on this text to display the desired output.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: [Challenge] - Regex

Post by josh »

klevis miho wrote:I simply do what a regular expression on this text to display the desired output.
Exactly. we are not your personal work force.
Post Reply