Hi there,
I would like to use preg_match_all to get some data from a html file. Unfortunately, I have no clue about regular expressions and would very much appreciate some help.
In the html file, there is a section that looks like:
SpecificName('12345','6789');
I'd like to get the two numbers 12345 and 6789 and have everything expecpt for the regular expression that will get me the numbers in preg_match_all, i.e. I need the $PATTERN part in preg_match_all($PATTERN, $string, $matches).
Thank you very much in advance,
Markus
1 reply to this topic
#1
Posted 03 August 2011 - 01:08 PM
|
|
|
#2
Posted 03 August 2011 - 02:54 PM
This page might help, I think: PHP: PCRE regex syntax - Manual
As for that, :
if you don't want to deal with those patterns, you can use the explode() function to split the string on every 'SpecificName(\'' and iterate through the resulting array (excluding index 0) and split those strings with '\');' and work on index 0 of those arrays. You could then split that resulting string with '\',\'' and use index 0 for the first value and index 1 for the second. Then you go on to the next element in the first array.
That's what I would have tried to do, anyway.
As for that, :
Quote
SpecificName('12345','6789');
That's what I would have tried to do, anyway.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









