Re: preg_replace learning resources? Regex tuts? Tips? (and yes, I have been rtfm)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Eric Butera wrote:
On 5/25/06, Micky Hulse <micky@xxxxxxxxxxxxx> wrote:

Kevin Waterson wrote:
> Try this quicky
> http://phpro.org/tutorials/Introduction-to-PHP-Regular-Expressions.html

Sweet, good links all. Thanks for sharing!  :)

Have a great day.

Cheers,
Micky

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



I built something similar to the situation that you are describing.
One difference though is I used preg_replace_callback
(http://us2.php.net/preg_replace_callback) so that I can do custom
scripting with the matched string to be replaced.

I know I'm entering this discussion a bit late, but one tool that I've found indispensible in writing regular expressions (even after knowing how to write them) is The Regex Coach (http://www.weitz.de/regex-coach) (Free, and runs on Windows and Linux).

Essentially, you paste the text to search into the bottom textbox, and then start typing your regular expression into the top one. As you type, it shows you what it is matching in the bottom one. It can also show you what individual submatches are matching, and all sorts of neat stuff. So, if I have an HTML web page and I want to suck some specific information out of it, I'll paste the information in, write up a regex, and make sure it's matching what it's supposed to. But the feedback AS you're typing it is super handy. For example, if I have a regex, and I add a "[a-z]", then the indicator will show it matching the next character, then if I add "*", the text selection will expand to show it matching the rest of the letters, and so on.

Anyhow, I find the feedback as I write a regex to be addictively useful.

Regards, Adam Zey.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux