
SupraCharger
Members-
Posts
15 -
Joined
-
Last visited
Everything posted by SupraCharger
-
I was wondering about Efficiency. Say the user writes a script ( maybe a Function to make it easier on the User ). But the Client does Not need all of that script running over and over again to each client. So is there a Function that maybe writes a more basic script for the client, from the more complex script that does not need to run every time the page is loaded on the web?Thanx for your help, Andrew
-
Need help with preg Functions to make a Header & Footer
SupraCharger replied to SupraCharger's topic in PHP Coding Help
Thank you that fixed the issue, Andrew -
Hi, I'm trying to pull out parts of a html page and I've tried this for hours an I can't seem to get it to work. // I'm pulling this info from get_file_contents () $contfile = ' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <!-- PHP: Header End --> <!-- PHP: Footer Start --> </body> </html> '; $pattern = '/^(.*)(<!\-\- PHP: Header End \-\->)(.*)$/'; $replacement = "$1$2"; $header = preg_replace ($pattern, $replacement, $contfile); // I want it to output $header = ' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <!-- PHP: Header End --> '; I've tried to use other functions (preg_grep () , preg_match () ) and I can't get those to work. If you could please show me the syntax to how to properly accomplish this task It would be greatly appreciated. Thanx for your help, Andrew
-
This Should be the last bug. $pattern = '/^"?(C:\\\\)([[:alnum:]_*\-*\040*]+\\\\)*[[:alnum:]_*\-*\040*]+(\.)[[:alpha:]]{2,4}"?$/'; A.
-
This one will fix that. $pattern = '/^.?(C:\\\\)([[:alnum:]_*-*\040*]+\\\\)*[[:alnum:]_*-*\040*]+(\.)[[:alpha:]]{2,4}.?$/'; A.
-
nope this ones better $pattern = '/.?(C:\\\\)([[:alnum:]_*-*\040*]+\\\\)*[[:alnum:]_*-*\040*]+(\.)[[:alpha:]]{2,4}.?$/'; A.
-
(This one is Safer) I think this pattern that I wrote would work very well for Files the have double quotation marks around them. Ex: "C:\Users\Owner\Desktop\old_databases.docx" $pattern = '/.{0,1}(C:\\\\)([[:alnum:]_*-*\040*]+\\\\)*[[:alnum:]_*-*\040*]+(\.)[[:alpha:]]{2,4}.{0,1}$/'; Andrew P.S. While you guys did an amazing job explaining the concept, I think this post answers my first question the best.
-
I think this pattern that I wrote would work very well for Files the have double quotation marks around them. Ex: "C:\Users\Owner\Desktop\old_databases.docx" $pattern = '/.*(C:\\\\)([[:alnum:]_*-*\040*]+\\\\)*[[:alnum:]_*-*\040*]+(\.)[[:alpha:]]{2,4}.*$/'; Andrew P.S. While you guys did an amazing job explaining the concept, I think this post answers my first question the best.
-
Thanx all for clearing that up for me, the mash of Chars in regular expressions gives me tunnel vision. But I forgot the regex engine stips the escape char '\' out. salathe, Is it because you don't want a didget extension ex: ( .213 ). Wait I forgot about the " $ ", I have no idea? Thanx, A.
-
Sry for that requinix, So to get a literal backslash in parentheses" () " you do this: \\\\. what about when you want a literal backslash not in parentheses do you still do this: \\\\ Thanx, A.
-
Thank you Christian F. you really know your stuff, I still can't seem to get this pattern right from the top of the thread. requinix, The pattern did not work. There where no errors but it didn't validate correctly. I Think '\\\\' in '(C:\\\\)' is for double quotes. $pattern = '/^(C:\\)[[:print:]]$/'; For Validating: C:\Users\Owner\Desktop\old_databases.docx Thanx, A.
-
Thank you salathe, I wanted this for html. So I can say something like this From: (<form> tag) (don't worry about the chars in here) End: (</form>) So [[:print:]] is the best option? Thanx, Andrew
-
Thank you for that fix requinix. Do you or does anyone know of a class or Syntax on: how to have any alpha numeric characters & all the symbols on the keyboard ? Is it [[:ascii:]] ? I found info on this: http://www.asciitable.com/ Thanx for your time, Andrew
-
Hi all, I'm trying to get this regular expression to work, but I keep getting a error: Warning: preg_match(): Unknown modifier ']' $pattern = '/^(C:\\)[A-Za-z0-9\040\.\-\\\/]$/'; $pattern = '/^(C:\\)[[:alnum:]\040\.\-\\\/]$/'; // Also tried this pattern if (preg_match ( $pattern, trim ($_POST['contfile']) )) Thanx for your help, Andrew