Tuesday, 15 February 2011

regex - regular expression pattern in PHP -


Please help find the correct pattern of the following matter

There are simple strings: < Pre> pdf / 20120102 / A1_standard.pdf pdf / 20130431 / 1.pdf pdf / 20110506 / abcde.pdf pdf / 20131201 / fff-01/02/12 / -A1.pdf

For the object I need to match A1standard PDF, 1. PDF, ABCDDPDF, FFF-01/02/12 / -a PDF. I /// *. Pdf / as pattern but this is not working, case 4 is more difficult because file name has '/', if it can not be left now, then incorporate this case. Thank you.

Try this:

  $ str = 'pdf / 20120102 / A1_standard.pdf '; Preg_match ('? / (P & lt; file & gt;; w [\ -] \ pdf) $ /', $ str, match $); Echo "& lt; east & gt;"; Print_r ($ match); Echo $ match ['file'];    

No comments:

Post a Comment