| | |
PHP4 regular expressions?
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2007
Posts: 86
Reputation:
Solved Threads: 6
Hey all,
ok, so, I am a bit weird in my questions but, that's just me. I have a fairly weird one for you.
I have been using RegExSearchReplace (A Java Program) to do this the um, tedious way, but I was hoping there was an easier way to deal with this issue.
I have a huge project consisting of over 80 classes, each of which have several methods.
As this is an inherited project, I am having issues figure certain things out. There are several subfolders with include folders, and because htaccess has all of these folders as include folders, a lot of files are simply used with a require_one and no path name.
So, what I am wanting to do is, create a script that will search every file under a directory (including it's subdirectories), search for a certain thing, then add it to the database.
using the above mentioned java program, I can do the search, but I am doing the additions by hand, and it's getting a bit longwinded.
I cooked up these regular expressions to use with it.
Mind you, these are java regular expressions, and the ( and ) denote groups. I was figuring there might be some way to tap into groups, and say the value of group 3 is the function name, or whatever.
At any rate, how would I go about doing this to where I can simply click a button and trigger the script to run, and send the information that I am looking for into the database?
The problem is that I can't figure out how to use the infromation that is a match to the search expression, nor how to search through a directory and subdirs recursively.
At that point, it would be a good idea if I were able to also capture the file path and file name that these items reside in.
Any thoughts on this?
Mike
BTW: I'm aware of programs such as PHPdoc and so on, but these aren't going to help me. I would be required to actually go through each file and make specialized comment notation whic would pretty much defeat the purpous.
ok, so, I am a bit weird in my questions but, that's just me. I have a fairly weird one for you.
I have been using RegExSearchReplace (A Java Program) to do this the um, tedious way, but I was hoping there was an easier way to deal with this issue.
I have a huge project consisting of over 80 classes, each of which have several methods.
As this is an inherited project, I am having issues figure certain things out. There are several subfolders with include folders, and because htaccess has all of these folders as include folders, a lot of files are simply used with a require_one and no path name.
So, what I am wanting to do is, create a script that will search every file under a directory (including it's subdirectories), search for a certain thing, then add it to the database.
using the above mentioned java program, I can do the search, but I am doing the additions by hand, and it's getting a bit longwinded.
I cooked up these regular expressions to use with it.
PHP Syntax (Toggle Plain Text)
/* Find a class */ (class )([a-zA-Z0-9]+)(.\{) /*find a function or method */ (function )([a-zA-Z0-9]+)(.\{) /* find new instance of a class*/ (\$[a-zA-Z0-9]+)(= new )([a-zA-Z0-9]+\(\))
Mind you, these are java regular expressions, and the ( and ) denote groups. I was figuring there might be some way to tap into groups, and say the value of group 3 is the function name, or whatever.
At any rate, how would I go about doing this to where I can simply click a button and trigger the script to run, and send the information that I am looking for into the database?
The problem is that I can't figure out how to use the infromation that is a match to the search expression, nor how to search through a directory and subdirs recursively.
At that point, it would be a good idea if I were able to also capture the file path and file name that these items reside in.
Any thoughts on this?
Mike
BTW: I'm aware of programs such as PHPdoc and so on, but these aren't going to help me. I would be required to actually go through each file and make specialized comment notation whic would pretty much defeat the purpous.
Last edited by sagedavis; Apr 4th, 2008 at 10:57 pm. Reason: code tag typoed
![]() |
Other Threads in the PHP Forum
- Previous Thread: errors and errors
- Next Thread: Please help me!!!!!!!
| Thread Tools | Search this Thread |
.htaccess alerts apache api archive array autocomplete beginner binary broken cakephp checkbox class cms code convert cron curl database dataentry date display duplicates dynamic echo email emptydisplayvalue error errors execute explodefunction file files firstoptioninphpdroplist folder form forms function functions google hack href htaccess html htmlspecialchars image include insert ip javascript joomla keywords limit link login loop mail menu methods mlm multiple mysql network object oop paypal pdf php problem query radio random recursion recursive redirect remote script search securephp server sessions shot sms source space sql subscription syntax system table tutorial tutorials update upload url validator variable video web youtube





