Helpful Information
 
 
Category: Regex Programming
RegExp trouble

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

With this example

/href=(\"|\')(myurl|)/

the only match i have are:

href="myurl
and
href='https://forums.devshed.com/archive/index.php/myurl

but not

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


Thank you all...

the ? modifier can be used to tell something can exists zero or one time.

this should work:
/href=(\"|\')?(myurl|)/

It works! Thank you very much!










privacy (GDPR)