Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Other - Discussion
Author Message
gregexp
The Mouse Is Extension Of Arm



Joined: Feb 21, 2006
Posts: 1497
Location: In front of a screen....HELP! lol

PostPosted: Sat Aug 05, 2006 11:03 am Reply with quote

Perhaps I need a rethinking of all this but you all may be able to help as well.

I want to find all variables and globalize them in order to check them within a function.

This is to see how much offsite content is being persued from the server/browser.

Problem I'm having is that when I use preg_split, It returns like this:
preg_split("/(\\$)/",'testing$testingh.bklj',-1,PREG_SPLIT_DELIM_CAPTURE );

Array ( [0] => testing [1] => $ [2] => testingh.bklj )

Now this is the testing stage and I wanted results I can be sure of and not just guess at it.

I want it to print
$testingh

no period or anyother non-word character, but right now I'm working on forcing it to display at least $testingh.bklj

Until I get that far, It wont help to stop it at the period or other non-alphanumerical character.

Any help is appreciated.

On a side note, sorry guys, been working like crazy for the last week and it wont let up for at least a month so I'll still be around just not anywhere near like I used to be. Weekends are all booked too.
I know I'm so loved here Laughing
Hopefully I'll be back on a role soon enough, Just want to put the spare time I have into this project and a few others.

_________________
For those who stand shall NEVER fall and those who fall shall RISE once more!! 
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
gregexp







PostPosted: Sat Aug 05, 2006 8:23 pm Reply with quote

Ok got it.

I did this:
$included_files = get_included_files();
foreach ($included_files as $filename) {
echo "$filename\n<BR>";
$file_contents=file_get_contents($filename);

//break down into components to turn into an array
$break=preg_split("/(\\$)/",$file_contents,-1,PREG_SPLIT_DELIM_CAPTURE );

//Join the components to make $,varname look like $varname and turns into a string again.
$string=join(',',$break);

//set search so that it will not count these as var names
$split=array('-','=','(',')',';','[',']','/','+','"','<','>','\'');
$string=str_replace('$,','$',$string);
$string=str_replace('.',',',$string);
$string=str_replace(' ',',',$string);
$string=str_replace($split,',',$string);
$string=stripslashes($string);

//format now complete, each var name should be in the correct format with other data not being necessary so lets rejoin them but now as an array
$string=preg_split('/[,]/',$string);
//print_r ($string);

//break the array up into its components.
foreach($string as $string2){

//dont show unecesary junk
$var_test=eregi('\\$',$string2);
if($var_test ==1 AND $string2!='$'){
//global $string1;
//$string1=array($string1,$string2);
echo "$string2<br>";


Hey look I'm learning regular expressions, go me killing me

Now to Put this in a string to verify no duplicates, then to globalize all the variables to show what they are meaning.

I started working on an offsite content block but it kinda turned into a diagnostic script tool.
 
VinDSL
Life Cycles Becoming CPU Cycles



Joined: Jul 11, 2004
Posts: 614
Location: Arizona (USA) Admin: NukeCops.com Admin: Disipal Designs Admin: Lenon.com

PostPosted: Sat Aug 05, 2006 9:02 pm Reply with quote

darklord wrote:
Hey look I'm learning regular expressions, go me killing me

Regex rocks, doesn't it?

You probably already know about this place, but for ppl that don't:

http://www.regexlib.com/default.aspx

This is getting to be one of my (ahem) regular hangouts... Laughing

_________________
.:: "The further in you go, the bigger it gets!" ::.
.:: Only registered users can see links on this board! Get registered or login! | Only registered users can see links on this board! Get registered or login! ::. 
View user's profile Send private message Visit poster's website ICQ Number
gregexp







PostPosted: Sat Aug 05, 2006 9:28 pm Reply with quote

Yeah It does rock, but I like the old fashion search('something','in_something')
killing me
but reg ex allows for a lot more functionality, but HARDER to code.

I think I'm getting it down took me about an hour to come up with those killing me
With time.

I decided to do even more with this, I wrote all the included files into one big file.
This should help someone to know which files are actually making up the files being loaded. All in one package should make it easier for people to find errors.
Still a LOT to be done.
I think an early retirement may be necessary Laughing
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Other - Discussion

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©