Jump to content

[SOLVED] Simple Regex Help


jjacquay712

Recommended Posts

Hey guys, i suck at regex and was wondering if you could help me out. All i need is a simple url finder that matches the url that starts with http:// or https:// and stops when it finds a space. I searched the entire internets and couldent find anything like this.

 

                            Thanks for the help, John

Link to comment
https://forums.phpfreaks.com/topic/157173-solved-simple-regex-help/
Share on other sites

#^https?://[^\s]+#

 

With regards to searching the internet for these kind of solutions, you might be better off learning regex itself instead. That way, you will be able to forumlate your own regex solutions instead of fishing for solutions (which may not be exactly what you are looking for).

 

You can have a look at these links:

regex tutorial

webblogtoolscollection

mastering regular expressions

php freaks resources

php freaks tutorials

thanks for the help, i have tried to learn regex many times but i cant seem to remember the syntax.

 

Repetition is the mother of all skill. It's like anything else.. it takes time and constant exposure. Regex itself is not hard per say.. it's more or less 'the rules of engagement'. But once you start to get on the ball, you'll see that it's not all that bad. Just have to keep reading up on it, and trying things out. Otherwise, you're doomed to always asking people for solutions... and what happens if no one helps out?

 

Kind of like 'give a man a fish, and he can eat for a day.. teach a man to fish, and he can eat for a lifetime.' sort of thing. By learning it, you don't become reliant on others. Just takes some time and effort (which is well worth it IMO).

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.