RegExp trouble

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
fabio.casolari
Forum Newbie
Posts: 2
Joined: Wed Nov 12, 2008 3:59 am

RegExp trouble

Post by fabio.casolari »

I have to math an URL in an href link that can have single or double quote or not.

With this example

/href=(\"|\')(http:\/\/www\.my\.url|)/

the only match i have are:

href="http://www.my.url
and
href='http://www.my.url

but not

href=http://www.my.url

how i can make a regexp that match this type of code?


Thank you all...
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: RegExp trouble

Post by VladSun »

Code: Select all

/href=("|')?(http:\/\/www\.my\.url|)/
There are 10 types of people in this world, those who understand binary and those who don't
fabio.casolari
Forum Newbie
Posts: 2
Joined: Wed Nov 12, 2008 3:59 am

Re: RegExp trouble

Post by fabio.casolari »

It works! Thank you very much!
Post Reply