The Most Active and Friendliest
Affiliate Marketing Community Online!

“AdsEmpire”/  Direct Affiliate

htaccess regular expressions

paulund

New Member
affiliate
Hello

I am trying to generate a regular expression to match all words before a group of characters which is in-. The problem I am having is limiting this to the first in-.

For example if I have a string:
Variable1-in-variable2

I can get these 2 variables by using the expression
/([^\.]+)-in- ([^\.]+)(.*)

But if variable2 has the characters in- the expressions to return the variable1 will also return characters in variable up to the in-.

The expression found to get around this problem is ((?:(?!-in-).)*) which worked on my development server but when moved onto another server it returned a 500 internal server error because the htaccess is failing. When I checked the server logs I was getting the error:

RewriteRule: cannot compile regular expression '^([^/]+)/([^/]+)/((?:(?!-in-).)*)(-in-)([^\\.]+) (.*)'\n.

How would I rewrite the expression ((?:(?!-in-).)*) to return the 1st variable up to the characters -in-?

Thanks
 
banners
Back