Jump to content


Photo

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


  • Please log in to reply
1 reply to this topic

#1 apollo_driver

apollo_driver
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 29 August 2006 - 11:38 PM

:) 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

what does preg_match do - http://www.php.net/preg_match 

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.

we believe: 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.

job 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 http://www.phpbbdoct.../doc_tables.php  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 timestamp - i need the timestamp.

how to parse the Source - of a example page  http://www.phpbb.de/...29465&view=next
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

http://www.phpbbdoct.../doc_tables.php  but how do we proceed.

i want to run the preg_matc  http://www.php.net/preg_match 
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
http://www.phpbb.de/...rdf_parser.phps


look forward to hear from you

regards Hinault :)

#2 effigy

effigy
  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 29 August 2006 - 11:51 PM

Guten Tag,

You want to scan the URL http://www.phpbb.de/...29465&view=next for words such as categories, forums, and posts?
Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users