|
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]
|