PHP Regex using the \Q \E syntax -


I am reading and it says: all the letters between \ q and \ e are interpreted The literal letter like

  $ pattern = '/ \ \ * * \ d + * \ E matches the literal text * \ d + *.   

Q ~! @ # $% ^ & Amp; () _ + |} {? & Gt; & Lt; / /] \ "[':'; \ E \ '; string =' ~! @ # $% ^ & Amp;;; * () _ + |} {& gt; & lt ;, / ] [": ';';?. Preg_match ($ patterns, $ string, $ matches); Echo "& lt; east & gt;"; Print_r (matches $); Echo "& lt; / pre & gt;";

This gives me an error:

  Parse error: syntax error, unexpected '~' in / application / XAMPP / Ximpipil / HTTox / xampp / web_development / NEU_Stridi_2014 / REJX.FPP on line 3   

Why is it not working as described above?

You forgot to cite your ' inside the pattern:

  $ pattern = '/ \ Q ~! @ # $% ^ & Amp; ; * () _ + |} {? & Gt; & Lt ;, / \] [": '; \ E /'; ^ - Start String # 1 ^ - End String # 1 ^ - Start String # 2 $ String = '~! @ # $% ^ & Amp; * () _ + |} {? & Gt; & lt ;, / \] [':'; '; ^ --- End of string # 2 --- --- Your error, because it is outside the string    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -