preg replace - php preg_replace working only if there's ending space in string -


i have pattern:

preg_replace_callback('#@abc\((.*?)\)(.*?)@end.#is', .. 

my template string:

$test = "@abc('test')<h1>test</h1>@end"; // not working $test2 = "@abc('test')<h1>test</h1>@end "; // working 

why doesn't work if there's no space after @end?

as @rizier123 pointed out, correct regex:

preg_replace_callback('#@abc\((.*?)\)(.*?)@end#is', .. 

Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -