PHP - Regular Expressions and Patterns

preview_player
Показать описание
PHP - Regular Expressions and Patterns

A. Project Source for PHP/SQL Game "Pretty Ponies"
----------------------------------------------------------------------------------------------------------------------------

B. Generic Database Code
----------------------------------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------------------------------
Рекомендации по теме
Комментарии
Автор

amazing regex presentation, good work and thanx a lot

tarakgandhi
Автор

Thank you for this, excellent teaching. 

JackiePrime
Автор

Thanks bro. You really spend some time making this awesome tutorial. Greetings from Nepal. Best wishes for upcomming tutorials.

ashishneupane
Автор

Please forgive my ignorance as I am just beginning my "journey" with PHP regular expressions :) In your list of examples that starts around :40, can you explain how $Sword matches since it is not at the very end (there's a '!' after Sword), and how ^obtains$ matches, since there are characters before and after "obtains"? Thanks!

zamazina
Автор

These functions like ereg() and ereg_replace have been deprecated, they are highly discouraged

meesie
Автор

This must be one the most pedagogical regex presentation that I've found on Youtube, and the examples are nice. Some corrections though - the syntax descriptions throughout the video are all correct, e.g. for ^ and $, but the examples are not. E.g., the pattern '$Sword' does not mean "'Sword' at the end of the string", it means "the end of the string followed by 'Sword'", which will never match anything. The correct syntax would be 'Sword$' (actually with a ! given the example).
On the same slide, '^obtains$' matches only the string which consists only of "obtains". Literally - beginning of string followed by obtains followed by end of string. This is distint from 'obtains', which matches anything containing 'obtains', including 'unobtains..able', which in turn is distinct from the pattern '\bobtains\b', which matches 'obtains' only when it is its own word (maximal alphanumeric substring). In some of the following examples, '$' should not appear in the regex. In general, one rarely needs to use ^ or $ and it is better to write the regexp without it or only use word boundaries. Calling '*' for a wildcard can be misleading - it is only a quantifier.

You have likely already noticed these issues but it seemingly still generating questions in the comments :). From the tutorials I have seen on youtube, yours has so far been the best but these matters prevent me from sharing it - perhaps you could add some tags in the video for future viewers?

Thanks for the upload.

negijosuf
Автор

09:57 Toilet flusing? Anyway, very nice tutorial. I struggled a lot with regular expressions and I completely get it now. Thank you very much!

Maztergyl
Автор

Thanks. I think there is some wrong things in tutorial, but who cares, i'll correct it after practice by myself :)

ra