Jump to content

roydukkey

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

roydukkey's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. What is the difference between the two? Tried for hours to fix this and don't know exactly the reasons it works. preg_replace("/\$inc\s+\(([^\)]+)\)/im", $replace, $subject); // Breaks - single quotes preg_replace('/\$inc\s+\(([^\)]+)\)/im', $replace, $subject); // Works - double quotes
  2. Though these suggestions are good, there not quite what I need. I need to retain all the input data, comments and everything else. And, then I did you process each match and place it back exactly where it came from, hence the preg_replace_callback.
  3. Ok, I need more help. Hopefully someone understands this. This following code us sucessful, however I need it to do more. It currently finds '$inc (<<path>>)' and returns '<<path>>'. I need the script to disregard the current match when it is between '/*' and '*/'. Thanks you anyone willing to help. $output = preg_replace_callback('/\$inc\\s*\(([^\)]+)\)/is', create_function( '$match', 'global $domain; array_push( $includedFiles, $match[1]); return trim(file_get_contents( $domain.$match[1] ));' ), $output );
  4. Thanks all for you posts. thebadbad had the answer i was looking for thanks!
  5. Here is the what i need to happen. Much thanks to anyone willing to help. I need to replace 'f=varying-string' from 'f=varying-string&killer=lop&you=pop'. The string need to be replaced no matter where it is. ie. 'killer=lop&f=varying-string&you=pop' I'm trying this: preg_replace( "/^[f=].*(^&.*$)$/is", "", $_SERVER['QUERY_STRING'] );
  6. ok but there is a problem, this works great until there are hyphens in the variable. ex. $str = '/Assignment1/images/doors/09-10-2008'; $str = preg_replace('#(/\w+)$#', '', $str); echo $str; $str equals '/Assignment1/images/doors/09-10-2008' when $str should equal '/Assignment1/images/doors' How could this be fixed? thx
  7. if i have: var = "/Assignment1/images/doors" how can i use preg_replace to gain: var = "/Assignment1/images" Thanks roydukkey
  8. Ok, sounds good...? I'll do some more learning and post back if I need anything more. Thank you very much for you help, nrg_alpha.
  9. I have a string [block of text from a file via fopen()] that I would like to split into a multi-dimensional array. Here the contents of the file that is opened: Father { son child { bob john jim } } mother { daughter kin } bigfoot { hairy kisses } How can I use preg_split() to result in the following array or if there is a better way how can this be done: Array ( [ 0 ] => Father ( [ 0 ] => son [ 1 ] => child ( [ 0 ] => bob [ 1 ] => john [ 2 ] => jim ) ) [ 1 ] => mother ( [ 0 ] => daughter [ 1 ] => kin ) [ 2 ] => bigfoot ( [ 0 ] => hairy [ 1 ] => kisses ) ) Thanks for your help. roydukkey
×
×
  • 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.