Regex Help.


#1

Basically I require a regex to search for all href=" in a string, however, only match those without http:// after. I came up with a regex however there are three problems.

a) It will not match if there is a h after the href="
b) It matches the next character after href="
c) It doesn’t even work properly.

The regex was href="[^http]

Does anyone know the correct regex?


#2

I’m no expert on regex’s, but that will match anything except the letters h, t, or p after the href="

What you need is something like href="[^(http)]…i think anyways, something to group the http together anyways.


#3

fyi- there is a 3 part series on regrex in phparchitect starting in the mar 04 edition. It is very good (though heavy reading). If you are just looking for the basics you can just read that article in the march issue. And don’t for get there is always the manual. (I suck at it though :) )