2
I have the following text example:
Meusreportspdf001-Capa-Disclaimer-22012017
I want to capture with php regular expressions the texts
"Cover", "Disclaimer" and "22012017".
I’m trying to use the function preg_match_all()
as follows:
preg_match_all("MeusRelatoriosPDF001-(\w*)-(\w*)-(\w*)",$links,$array);
Where in the parameter $links
comes the texts separated by the indicated strokes. It is also worth mentioning that the 3 parameters do not always come in the variable. Ex: The variable $link
could only come
"Meusreportspdf001-Capa-Disclaimer" or "Meusreportspdf001-Capa"
The mistake that is emerging is
"Warning: preg_match_all(): Delimiter must not be alphanumeric or backslash".
Can someone help me how I could capture these texts and put each variable in a position of $array
?
That mistake says you missed
//
between the regex, one at the beginning another at the end.– rray
I tried it as follows: preg_match_all("/Meusreportspdf001-( w*)-( w*)-( w*)/",$links,$array); and in the $array variable everything came empty.
– Christian
A
explode()
for-
would not be simpler or does not solve the problem?– rray