Welcome Guest, Not a member yet? Register   Sign In
Issue with anchor function and preg_match
#1

[eluser]Unknown[/eluser]
I'm getting an error with the regular expression used in CI's anchor() function with preg_match(). Specifically, the following line:

Code:
$site_url = ( ! preg_match('!^\w+://! i', $uri)) ? site_url($uri) : $uri;

I've identified the problem as being the space character between the closing delimiter '!' and the case insensitivity flag 'i' at the end of the expression.

I'm actually running a tool (Quercus) that converts PHP into Java, so my guess is that the syntax shown is acceptable in PHP but not in the Java routine that preg_match is converted into by this tool. However, since I am not actually running PHP on my server (it's all converted into Java at runtime), I can't verify this. I guess what I need clarification on are the following:

1) Is the syntax as listed above valid in PHP?
2) Is it valid if the space described is removed?




Theme © iAndrew 2016 - Forum software by © MyBB