You are here: Re: Help with regex « PHP Language « IT news, forums, messages
Re: Help with regex

Posted by Carl Pearson on 01/11/07 04:03

For a quick start:
http://www.ilovejackdaniels.com/cheat-sheets/regular-expressions-cheat-sheet/

If you want to learn RegEx, get Mastering Regular Expressions by Jeff
Friedl. The recently released 3rd edition is at nerdbooks.com for about
$25.

Mikkel Z. Herold wrote:
> Hi.
>
> I have a problem with a regex - I hope someone here can help (though
> strictly speaking it is not a php issue):
>
> I have this regex that I use to check the syntax of URLs:
>
> ^((ht|f)tps?://)((([a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3}))|(([0-9]{1,3}\.){3}([0-9]{1,3})))((/|\?)[a-z0-9~#%&'_\+=:\?\.-]*)*)$
>
>
> I need to modify it, so that it accepts URLs with an "@" in them, such
> as http://person.au.dk/da/dekan.hum@au.dk.
>
> I have tried this
>
> ^((ht|f)tps?://)((([a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3}))|(([0-9]{1,3}\.){3}([0-9]{1,3})))((/|\?)[a-z0-9~#%&'_\+=:\?\.-@]*)*)$
>
>
> and that accepts URLs with @, BUT it rejects all other well-formed URLs!
>
> As you can tell, I don't know much about regex'es, and the above is one
> I have cut'n'pasted. Hope someone can help me out.
>
> This message is X-posted to alt.php. FUT to alt.comp.lang.php
>
> Mikkel
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация