Jump to content

preg_match in a hurry [damned quick and very dirty approach;-)]


apollo_driver

Recommended Posts

:) howdy - good day phpFreaks,

well this is the preg_match in a hurry [quick and dirty approach;-)] - thread. I do not want to shock you but - this is very dirty. Well i want to apply the preg_match to a special task want to perform a regular expression match

[B]what does preg_match do[/B] - [url=http://www.php.net/preg_match]http://www.php.net/preg_match[/url] 

int preg_match ( string pattern, string subject [, array &matches [, int flags [, int offset]]] ) Searches subject for a match to the regular expression given in pattern. If matches is provided, then it is filled with the results of search. $matches[0] will contain the text that matched the full pattern, $matches[1] will have the text that matched the first captured parenthesized subpattern, and so on.

[b]we believe:[/b] we guess that ereg is a regular expression function, based on the POSIX regular expression standard. Preg (Based on PCRE) should be used instead, as its more extensive, often faster, and POSIX will disappear into PCECL in future versions). In likelihood, we ll take the source code and use preg_match/replace or substr on it, searching for the bits you need. Using PCRE modifiers, we can specify that the file's contents are treated as
a single line, which negates the need for linebreak sanitization.

[b]job[/b] i want to run preg_match/replace or substr on a file;

So out of intuition and looking at some examples i managed to come up with these data...

see [url=http://www.phpbbdoctor.com/doc_tables.php]http://www.phpbbdoctor.com/doc_tables.php[/url]  see the sourcecode and have alok at it:

phpbb_categories
phpbb_forums Forums for your board.
phpbb_groups A group of users
phpbb_posts Posts for your board.
phpbb_posts_text The text for the post
phpbb_topics Topics for your board.
phpbb_users Base user information,
and the [B]timestamp [/B]- i need the timestamp.

how to parse the Source - of a example page  [url=http://www.phpbb.de/viewtopic.php?t=129465&view=next]http://www.phpbb.de/viewtopic.php?t=129465&view=next[/url]
see the sourcecode and now imagine - i need the data

categories,
forums
posts
post_texts
post_topics
users

Finds all data on web page with that have to do with the data

[url=http://www.phpbbdoctor.com/doc_tables.php]http://www.phpbbdoctor.com/doc_tables.php[/url]  but how do we proceed.

i want to run the preg_matc  [url=http://www.php.net/preg_match]http://www.php.net/preg_match[/url] 
the results should go into an ARRAY that can be taken to a database, a phpBB-database with certain tables, were the data were put in.

i hope that i colud tell whats needed. And now i need some advices.

btw - can we benefit from this
[url=http://www.phpbb.de/rdf/rdf_parser.phps]http://www.phpbb.de/rdf/rdf_parser.phps[/url]


look forward to hear from you

regards Hinault :)
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.