code_junkie

Passing a commented, multi-line (freespace) regex to preg_match

Nov 10th, 2011
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. preg_match('
  2. ^J[0-9]{7}:s+
  3. (.*?) #Extract the Transaction Start Date msg
  4. s+J[0-9]{7}:s+Projectsname:s+
  5. (.*?) #Extract the Project Name
  6. s+J[0-9]{7}:s+Jobsname:s+
  7. (.*?) #Extract the Job Name
  8. s+J[0-9]{7}:s+
  9. ', $this->getResultVar('FullMessage'), $atmp);
  10.  
  11. preg_match("/
  12. test
  13. /x", $foo, $bar);
  14.  
  15. preg_match('/
  16. ^J[0-9]{7}:s+
  17. (.*?) #Extract the Transaction Start Date msg
  18. s+J[0-9]{7}:s+Projectsname:s+
  19. (.*?) #Extract the Project Name
  20. s+J[0-9]{7}:s+Jobsname:s+
  21. (.*?) #Extract the Job Name
  22. s+J[0-9]{7}:s+
  23. /x', $this->getResultVar('FullMessage'), $atmp);
  24.  
  25. preg_match('
  26. ^J[0-9]{7}:s+
  27. (.*?) (?#Extract the Transaction Start Date msg)
  28. s+J[0-9]{7}:s+Projectsname:s+
  29. (.*?) (?#Extract the Project Name)
  30. s+J[0-9]{7}:s+Jobsname:s+
  31. (.*?) (?#Extract the Job Name)
  32. s+J[0-9]{7}:s+
  33. ', $this->getResultVar('FullMessage'), $atmp);
  34.  
  35. preg_match('
  36. ^J[0-9]{7}:s+
  37. (.*?) (?#Extract the Transaction Start Date msg)
  38. s+J[0-9]{7}:s+Projectsname:s+
  39. (.*?) (?#Extract the Project Name)
  40. s+J[0-9]{7}:s+Jobsname:s+
  41. (.*?) (?#Extract the Job Name)
  42. s+J[0-9]{7}:s+
  43. ', $this->getResultVar('FullMessage'), $atmp);
  44.  
  45. preg_match(
  46. '/(?x)^J[0-9]{7}:s+
  47. (.*?) #Extract the Transaction Start Date msg
  48. s+J[0-9]{7}:s+Projectsname:s+
  49. (.*?) #Extract the Project Name
  50. s+J[0-9]{7}:s+Jobsname:s+
  51. (.*?) #Extract the Job Name
  52. s+J[0-9]{7}:s+/'
  53. , $this->getResultVar('FullMessage'), $atmp);
  54.  
  55. preg_match('
  56. /(?x)^J[0-9]{7}:s+
  57. (.*?) #Extract the Transaction Start Date msg
  58. s+J[0-9]{7}:s+Projectsname:s+
  59. (.*?) #Extract the Project Name
  60. s+J[0-9]{7}:s+Jobsname:s+
  61. (.*?) #Extract the Job Name
  62. s+J[0-9]{7}:s+/
  63. ', $this->getResultVar('FullMessage'), $atmp);
Add Comment
Please, Sign In to add comment