Re: [PHP] regex
On Wednesday 04 May 2005 21:31, Sebastian wrote: very new to regex i have a string with bbcode such as [img=XXX] (XXX being numeric) how do i search the string for the value of the bbcode and compare it to another variable? so i can take XXX and compare it to $image dynamically. Try this regex: /^img=(\d+)$/ thanks for any help. -- Cyberly yours, Petar Nedyalkov Devoted Orbitel Fan :-) PGP ID: 7AE45436 PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436 pgpWwTYi6BflP.pgp Description: PGP signature
Re: [PHP] regex
i partly solved the problem using this regex: $tutorial['pagetext'] = preg_replace_callback('#\[img\]\s*(\d+)\s*\[/img\]#siU', 'image_code_callback', $content['pagetext']); except instead of using [img]foo[/img] i would like to do just [img=foo] any help? Sebastian wrote: very new to regex i have a string with bbcode such as [img=XXX] (XXX being numeric) how do i search the string for the value of the bbcode and compare it to another variable? so i can take XXX and compare it to $image dynamically. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RegEx help
On Thu, 14 Apr 2005, Bosky, Dave wrote: I wanted to create a regex that force a PHP form text field to meet the following requirements: a. Must contain an 1 uppercase letter. [A-Z] b. Must contain 1 digit. [0-9] c. Must be a minimum of 7 characters in length. {7} if ( ereg([A-Z0-9], $field) strlen($field) = 7 ) { print(We have a winner!); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RegEx help
Philip Hallstrom wrote: On Thu, 14 Apr 2005, Bosky, Dave wrote: I wanted to create a regex that force a PHP form text field to meet the following requirements: a. Must contain an 1 uppercase letter. [A-Z] b. Must contain 1 digit. [0-9] c. Must be a minimum of 7 characters in length. {7} if ( ereg([A-Z0-9], $field) strlen($field) = 7 ) { print(We have a winner!); } nope, a username like 1234567 would go trough ok. Which isn't what he wanted -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RegEx help
Hi, Thursday, April 14, 2005, 11:47:13 PM, you wrote: BD I wanted to create a regex that force a PHP form text field to meet the BD following requirements: BD a. Must contain an 1 uppercase letter. [A-Z] BD b. Must contain 1 digit. [0-9] BD c. Must be a minimum of 7 characters in length. {7} BD I'm not sure of how to build the correct syntax for using all 3 BD requirements together. BD Any help? BD Thanks, BD Dave BD HTC Disclaimer: The information contained in this message BD may be privileged and confidential and protected from disclosure. BD If the reader of this message is not the intended recipient, or an BD employee or agent responsible for delivering this message to the BD intended recipient, you are hereby notified that any BD dissemination, distribution or copying of this communication is BD strictly prohibited. If you have received this communication in BD error, please notify us immediately by replying to the message and BD deleting it from your computer. Thank you. easier done seperately I think if( strlen($text) 6 preg_match('/\d+/',$text) preg_match('/[A-Z]+/',$text) ) { echo 'OK br'; -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RegEx help
I wanted to create a regex that force a PHP form text field to meet the following requirements: a. Must contain an 1 uppercase letter. [A-Z] b. Must contain 1 digit. [0-9] c. Must be a minimum of 7 characters in length. {7} if ( ereg([A-Z0-9], $field) strlen($field) = 7 ) { print(We have a winner!); } nope, a username like 1234567 would go trough ok. Which isn't what he wanted that's what I get for thinking too fast :) Seems like you should be able to do then um... ([A-Z]|[0-9]) as your regexp (check on escaping the ()'s or not. I can never remember) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RegEx help
On 15 Apr 2005 Tom Rogers wrote: BD a. Must contain an 1 uppercase letter. [A-Z] BD b. Must contain 1 digit. [0-9] BD c. Must be a minimum of 7 characters in length. {7} BD I'm not sure of how to build the correct syntax for using all 3 BD requirements together. easier done seperately I think if( strlen($text) 6 preg_match('/\d+/',$text) preg_match('/[A-Z]+/',$text) ) { echo 'OK br'; To do it in one fell swoop you need to use lookahead assertions -- something like this: if (preg_match('/(?=.*[A-Z])(?=.*[0-9]).{7,}/', $text)) echo 'Valid!'; I believe this matches for any string that has at least one uppercase letter and one digit and is at least 7 characters long. However it allows other characters as well (not just A-Z and 0-9). Lots of possible variations there. -- Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex
On Sun, March 20, 2005 3:18 pm, Colin Ross said: I'm trying to compress down a php-powered javascript file. In the file i have php run a bunch of loops and foreaches to build huge nested arrays for use in the javascript. Have you considered using PHP to write JavaScript that will build the arrays?... If the arrays are at all predictable from a smaller set of data, this can cut your bandwidth. One starts to wonder if you're not maybe just going down the wrong path entirely... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regex help
[EMAIL PROTECTED] wrote: OK, this is off-topic like every other regex help post, but I know some of you enjoy these puzzles :) This isn't an exam question, is it? ;) I need a validation regex that will pass a string. The string can be no longer than some maximum length, and it can contain any characters except two consecutive ampersands () anywhere in the string. I'm stumped - ideas? Yup, use this perl regex: /^(?:()(?!)|[^]){1,5}$/ Where 5 above is the maximum length of the string. You can change this to any positive value and the regex will still work. Basically it says look for 1 to 5 single characters where each either isn't an ampersand, or IS an ampersand but isn't immediately followed by an ampersand. The (?!) is a zero-width negative look-ahead assertion which is like other assertions such as \b that don't eat up the portions of the string that they match. Sample code, tested: $maxLen = 5; $testStrings = array( 'a', 'g', 'df', 'adfdf', 'adfsdfff', 'ff', 'dfds', 'dsdf', 'ddf', 'dff' ); foreach ($testStrings as $string) { if (preg_match(/^(?:()(?!)|[^]){1,$maxLen}$/, $string)) { print $string matches.\n; } else { print $string does not match.\n; } } Hope this helps you (pass your exam? ;) ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regex help
On Sat, 2005-01-29 at 08:58, Michael Sims wrote: [EMAIL PROTECTED] wrote: OK, this is off-topic like every other regex help post, but I know some of you enjoy these puzzles :) This isn't an exam question, is it? ;) I need a validation regex that will pass a string. The string can be no longer than some maximum length, and it can contain any characters except two consecutive ampersands () anywhere in the string. I'm stumped - ideas? Yup, use this perl regex: /^(?:()(?!)|[^]){1,5}$/ Where 5 above is the maximum length of the string. You can change this to any positive value and the regex will still work. Basically it says look for 1 to 5 single characters where each either isn't an ampersand, or IS an ampersand but isn't immediately followed by an ampersand. The (?!) is a zero-width negative look-ahead assertion which is like other assertions such as \b that don't eat up the portions of the string that they match. Great explanation. Thanks from one who has not had an exam for over ten years. Bret -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regex help
Bret Hughes wrote: On Sat, 2005-01-29 at 08:58, Michael Sims wrote: [EMAIL PROTECTED] wrote: I need a validation regex that will pass a string. The string can be no longer than some maximum length, and it can contain any characters except two consecutive ampersands () anywhere in the string. I'm stumped - ideas? Yup, use this perl regex: /^(?:()(?!)|[^]){1,5}$/ Great explanation. Thanks from one who has not had an exam for over ten years. Thanks...I actually just realized that the parentheses around the first ampersand are unnecessary (that was a leftover from a previous attempt), so this is simpler and will work just as well: /^(?:(?!)|[^]){1,5}$/ Or if you don't care about capturing portions of the match and then throwing them away: /^((?!)|[^]){1,5}$/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex help
Michael Sims wrote: I need a validation regex that will pass a string. The string can be no longer than some maximum length, and it can contain any characters except two consecutive ampersands () anywhere in the string. Yup, use this perl regex: /^(?:()(?!)|[^]){1,5}$/ [snip] Hope this helps you (pass your exam? ;) ) Thanks, Michael! I guess it is time for me to go review those zero-width negative look-ahead assertions - don't know how I missed them ;) And no, not an exam - this is real life. My days as a frolicking schoolboy are quite some distance behind me ;) Kirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex help
On 28 Jan 2005 [EMAIL PROTECTED] wrote: I need a validation regex that will pass a string. The string can be no longer than some maximum length, and it can contain any characters except two consecutive ampersands () anywhere in the string. This is an example of something that is easier to do (and probably faster) without using a regexp: if ((strlen($str) = $maxlen) (strstr($str, '') === FALSE)) str is valid else str is not valid -- Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex help
[EMAIL PROTECTED] wrote on 01/28/2005 03:19:14 PM: On 28 Jan 2005 [EMAIL PROTECTED] wrote: I need a validation regex that will pass a string. The string can be no longer than some maximum length, and it can contain any characters except two consecutive ampersands () anywhere in the string. This is an example of something that is easier to do (and probably faster) without using a regexp: if ((strlen($str) = $maxlen) (strstr($str, '') === FALSE)) str is valid else str is not valid -- Tom Thanks, Tom. I agree, but not an option at this time - other parts of the design require this to be a regex. Kirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex help
[EMAIL PROTECTED] wrote: OK, this is off-topic like every other regex help post, but I know some of you enjoy these puzzles :) I need a validation regex that will pass a string. The string can be no longer than some maximum length, and it can contain any characters except two consecutive ampersands () anywhere in the string. $text = $_REQUEST['text']; if (strlne($text) 42 !strstr($text, '')){ //kosher } else{ trigger_error(Invalid input, E_USER_ERROR); } Oh, wait, that's not Regex. Oh well. Too bad. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex help
[EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote on 01/28/2005 03:19:14 PM: On 28 Jan 2005 [EMAIL PROTECTED] wrote: I need a validation regex that will pass a string. The string can be no longer than some maximum length, and it can contain any characters except two consecutive ampersands () anywhere in the string. This is an example of something that is easier to do (and probably faster) without using a regexp: if ((strlen($str) = $maxlen) (strstr($str, '') === FALSE)) str is valid else str is not valid -- Tom Thanks, Tom. I agree, but not an option at this time - other parts of the design require this to be a regex. Gr. Okay, how about that regex callback thingie thing thing, and you can use a function that pretty much does: (strlen($1) 42 !strstr($1, '')) -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex help
On 28 Jan 2005 [EMAIL PROTECTED] wrote: Thanks, Tom. I agree, but not an option at this time - other parts of the design require this to be a regex. It is pretty easy to do with two regexps, one to check the length and another to see if there is a double . Would that work? I don't know off hand how to do it with a single regexp. If the design requires that every possible condition be checked with a single regexp then I would say, no offense intended, that the design is faulty. Regexps are good tools but are not universal for all possible conditions one might want to test. -- Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex help
[EMAIL PROTECTED] wrote on 01/28/2005 04:13:38 PM: On 28 Jan 2005 [EMAIL PROTECTED] wrote: Thanks, Tom. I agree, but not an option at this time - other parts of the design require this to be a regex. It is pretty easy to do with two regexps, one to check the length and another to see if there is a double . Would that work? I don't know off hand how to do it with a single regexp. If the design requires that every possible condition be checked with a single regexp then I would say, no offense intended, that the design is faulty. Regexps are good tools but are not universal for all possible conditions one might want to test. Thanks Tom and Richard. No offense taken. The design isn't mine, I am plugging in to another system that expects a regex. I think I may have to push back on this one :) Kirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex help
Mike Ford wrote: Just off the top of my head (and untested!), I'd try something like /b(\s+[^]*)?/ Cheers! Mike That pretty much seems to work the best. Thanks all! -- Jason Morehouse Vendorama - Create your own online store http://www.vendorama.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex help
On Thu, 13 Jan 2005 16:06:32 -0500, Jason Morehouse [EMAIL PROTECTED] wrote: Hello, I normally can take a bit of regex fun, but not this time. Simple enough, in theory... I need to match (count) all of the bold tags in a string, including ones with embedded styles (or whatever else can go in there). b and b style=color:red. My attempts keep matching br as well. Put in a \b to match a wordbreak after the 'b'. Something like this maybe: /b\b[^]*/i . -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] regex help
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -Original Message- From: Jason Morehouse Sent: 13/01/05 21:06 I normally can take a bit of regex fun, but not this time. Simple enough, in theory... I need to match (count) all of the bold tags in a string, including ones with embedded styles (or whatever else can go in there). b and b style=color:red. My attempts keep matching br as well. Just off the top of my head (and untested!), I'd try something like /b(\s+[^]*)?/ Cheers! Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] regex help
Do you have the example regex so far? I'd suggest maybe b[^r] might just do what you want -Original Message- From: Jason Morehouse [mailto:[EMAIL PROTECTED] Sent: 13 January 2005 21:07 To: php-general@lists.php.net Subject: [PHP] regex help Hello, I normally can take a bit of regex fun, but not this time. Simple enough, in theory... I need to match (count) all of the bold tags in a string, including ones with embedded styles (or whatever else can go in there). b and b style=color:red. My attempts keep matching br as well. Thanks! -- Jason Morehouse Vendorama - Create your own online store http://www.vendorama.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This message has been checked for all known viruses by the CitC Virus Scanning Service powered by SkyLabs. For further information visit http://www.citc.it ___ This message has been checked for all known viruses by the CitC Virus Scanning Service powered by SkyLabs. For further information visit http://www.citc.it ___ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex help
On Friday 14 January 2005 05:06, Jason Morehouse wrote: Simple enough, in theory... I need to match (count) all of the bold tags in a string, including ones with embedded styles (or whatever else can go in there). b and b style=color:red. My attempts keep matching br as well. Quick-n-dirty: preg_match_all('/(b|b\s+.*)/iU', $doo, $match); Feel free to extend to check for closing tags :) -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- New Year Resolution: Ignore top posted posts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex help
Jason Morehouse wrote: Simple enough, in theory... I need to match (count) all of the bold tags in a string, including ones with embedded styles (or whatever else can go in there). b and b style=color:red. My attempts keep matching br as well. I think something not unlike: '/b( .*|)/' The point being that you either have JUST '' OR you have a SPACE and whatever and '' I leave the capitalization and 'greedy' settings up to you. The previous solution using 'b[^r]' will work only until the goofball browser wars give us some other bX tag where X is a single character in the alphabet. There's a pretty cool Windows/Linux product a colleague swears by that's called RegexCoach (?) which will not only let you try out expressions/values and tell you which ones pass/fail, but you can highlight sub-sections of the expression/values and see what it matches piece by piece. It's donationware -- try it out and donate the $20 (oooh, hurt me) if you like it. http://www.weitz.de/regex-coach/ -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex help
On Thu, 2005-01-13 at 15:06, Jason Morehouse wrote: Hello, I normally can take a bit of regex fun, but not this time. Simple enough, in theory... I need to match (count) all of the bold tags in a string, including ones with embedded styles (or whatever else can go in there). b and b style=color:red. My attempts keep matching br as well. interesting. I usually try to specifically describe in english what I am looking for. in your case, I would say a string that begins with followed by zero or more spaces followed by a b or a B followed by zero or more spaces followed by zero or more anything followed by /\s*[bB]\s*.*/ or perhaps it is enough to say match a followed by 0 or more spaces followed by a b or a B and not followed by a r or a R and followed by zero or more anything followed by /\s*[bB][^rR].*/ These are untested but should be close and can be used in preg* functions. the greedy matching might grab too much stuff and I always forget how to do that when I hit it. try them, let us see the results and we can get there Bret -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex help
Jason Morehouse wrote: Hello, I normally can take a bit of regex fun, but not this time. Simple enough, in theory... I need to match (count) all of the bold tags in a string, including ones with embedded styles (or whatever else can go in there). b and b style=color:red. My attempts keep matching br as well. okay, you didn't show the regexp you currently have no worries - I happen to have struck the same problem about 9 months ago when I had to screenscrape product info from a static site for importation into a DB, heres a list of regexps which will hopefully give you enough info to do what you want (the fifth regexp is the one you should look at most closely): // strip out top and bottom $str = preg_replace('/[\/]?html/is','',$str); // strip out body tags $str = preg_replace('/[\/]?body[^]*/is','',$str); // strip out head $str = preg_replace('/head.*[\/]head/Uis','',$str); // strip out non product images $str = preg_replace('/img[^]*(nieuw|new|euro)\.gif[^]*\/?/Uis','',$str); // strip out font, div, span, p, b $str = preg_replace('/[\/]?(font|div|span|p|b[^r])[^]*/Uis','',$str); // table, td, tr attributes $str = preg_replace('/(table|td|tr)[^]*/Uis','$1',$str); // strip out the first table and hr? $str = preg_replace('/table.*hr/Uis','',$str, 1); // strip table, td, tr $str = preg_replace('/[\/]?(table|td|tr|h5)/Ui','',$str); // strip out all new lines $str = str_replace(\n, '', $str); // strip out tabs $str = preg_replace('/[\011]+/', ' ', $str); // strip out extra white space $str = preg_replace('/[ ]+/', ' ', $str); Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex issue
On Tue, 30 Nov 2004 17:18:33 -0800, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: All I want to do is capture the keyword (array, break, echo, etc) and color it. I'd do it like this: $source = 'this is a line of text'; $term = 'line'; $text = eregi_replace(($term), font color=red\\1/font, $source); -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] regex issue
I don't want to match something like linear though. I only want to match line or line( or line; and only replace the line portion of it. Thanks, Nate -Original Message- From: Greg Donald [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 30, 2004 5:36 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] regex issue On Tue, 30 Nov 2004 17:18:33 -0800, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: All I want to do is capture the keyword (array, break, echo, etc) and color it. I'd do it like this: $source = 'this is a line of text'; $term = 'line'; $text = eregi_replace(($term), font color=red\\1/font, $source); -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex issue
[EMAIL PROTECTED] wrote: All I want to do is capture the keyword (array, break, echo, etc) and color it. $txt = this is an array('test'); $pattern = /(array|break|echo|continue)([\(.|\s.|\;.])/; echo preg_replace($pattern, 'font color=red$0/font', $txt); This captures array( though and I just want array. That's because you're using $0 in the replacement. The value of $0 is the entire string being matched by the regex. In this case, array(. You only want to put the keyword submatch inside the font tag, then the rest of the matched string after it. That wasn't a very good explanation. Sorry, I'm tired. Anyway, change the preg_replace line to: echo preg_replace($pattern, 'font color=red$1/font$2', $txt); --Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] (Regex) not working, take a quick look at it plz?
On Friday 29 October 2004 23:12, Ryan A wrote: I totally suck at RegEx (but am trying to learn), I got the following from the web, but its not working for me... can anyone spot what I am doing wrong or whats wrong please? And what *exactly* is wrong? What did you expect the code to do? What did the code actually do? Did you try debuggiong it yourself? print_r() or var_dump() everything. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Rome wasn't burnt in a day. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regex Lookbehind help
Alex Hogan wrote: Hi All, I am trying to identify an email address in a page but I don't want to return the email if it's [EMAIL PROTECTED] Here's what I have; (\w[-._\w]*\w(?!webmaster)@\w[-._\w]*\w\.\w{2,3}) It returns nothing, however when I take out the lookbehind section; ([EMAIL PROTECTED],3}) it works fine, returning all email addresses in a page. What is wrong with my syntax? I just tried this out and the first regex is actually working for me on php 4.3.8 (cli). Can you post some code? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex Lookbehind help
I just tried this out and the first regex is actually working for me on php 4.3.8 (cli). Can you post some code? At this point all I'm trying to do is print the array with the addresses. $file=readfile('mypathto/myfile.html'); $patrn =(\w[-._\w]*\w(?!webmaster)@\w[-._\w]*\w\.\w{2,3}); $addresses =preg_match($patrn,$file); print_r($addresses); alex hogan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regex Lookbehind help
Alex Hogan wrote: I just tried this out and the first regex is actually working for me on php 4.3.8 (cli). Can you post some code? At this point all I'm trying to do is print the array with the addresses. $file=readfile('mypathto/myfile.html'); $patrn = (\w[-._\w]*\w(?!webmaster)@\w[-._\w]*\w\.\w{2,3}); $addresses =preg_match($patrn,$file); print_r($addresses); Check the documentation for preg_match()...it can't be used that way. It returns false or the number of matches, but not the matching text itself. To get the matches you have to supply the third parameter (matches). Plus you'll probably want to use preg_match_all() unless you only want to get the first match. Also, I don't believe readfile() is what you want. It looks like file_get_contents() is more in line with what you are trying to do. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex Lookbehind help
Check the documentation for preg_match()...it can't be used that way. It returns false or the number of matches, but not the matching text itself. To get the matches you have to supply the third parameter (matches). Plus you'll probably want to use preg_match_all() unless you only want to get the first match. I caught that after I reread the manual. Also, I don't believe readfile() is what you want. It looks like file_get_contents() is more in line with what you are trying to do. That's got it. Thanks... alex hogan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regex for Validating URL
-Original Message- From: Nick Wilson [mailto:[EMAIL PROTECTED] Sent: Thursday, September 02, 2004 11:59 AM Hi all, yeah, i know, i did do quite a bit of searching but I just cant find it... Does anyone have the regex to make sure an http address is full and without error? like http://www.example.com http://www.php.net/parse_url should do what you require. If all you want to do is filter out the different parts of the url and check if they exist or not. [ ignoring the rather OT discussion that this thread has lead to ] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
On Tue, 7 Sep 2004 10:58:48 +0300, Burhan Khalid [EMAIL PROTECTED] wrote: -Original Message- From: Nick Wilson [mailto:[EMAIL PROTECTED] Sent: Thursday, September 02, 2004 11:59 AM Hi all, yeah, i know, i did do quite a bit of searching but I just cant find it... Does anyone have the regex to make sure an http address is full and without error? like http://www.example.com http://www.php.net/parse_url should do what you require. If all you want to do is filter out the different parts of the url and check if they exist or not. Consider what you'd mark as a full url, do you want to accept ftp:// and such links as well.. quite generic, I'd go for smth like: /^([a-z]+):\/\/(([\w\.]+)\.([a-z]{2,3}))(:(\d+))?(\/.*)?$/ Which would give you: Array ( [0] = ftp://www.example.com.com.uk:88/something/to/remember [1] = ftp [2] = www.example.com.com.uk [3] = www.example.com.com [4] = uk [5] = :88 [6] = 88 [7] = /something/to/remember ) Here're seme things I didn't take into account: * double dots (www...example..com) * double slashes (www.example.com//asdfasf//asdfasf) * check for protocol validity, might wanna change the first part to (ftp|http|chrome|.. any protocol you want to accept) * I left everything after the first slash completely to the imagination of your input data - this can contain pretty much anything anyways * login details (user:[EMAIL PROTECTED]) If you want to have a full regex that is really complete, check out: http://www.foad.org/~abigail/Perl/url3.pl, and execute it .. (linked from http://www.foad.org/~abigail/Perl/url2.html) Enjoy! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
I know this is an old thread but I've been away for the weekend and I really want to say this... On Thu, 2 Sep 2004 20:40:45 +0200, Nick Wilson [EMAIL PROTECTED] wrote: You know guys? I think you all take this a bit too seriously, perdanticness (is there such a word?) is all well and good for an FBI agent but I stand by the claim that my original question really was rather simple. What you fail to realise is that none of us get paid to do this. I'm sure we all have different reasons, but I contribute when I can because this list (and the others I contribute to) have helped me in the past, and I'm absolutely certain they'll help me in the future. I used to be a lot more active here, but life changes and I've not had so much spare time. Others, like John, dedicate a lot more of their time to helping others out. That's the only way lists like this can be successful. What annoys a lot of us (fairly regularly) is that a seemingly large number of people assume that if they ask a question here they will get, or more likely that they are entitled to get the solution rather than help or advice. All we ask is that you do a bit of research, try and solve it yourself and if you're still stuck post a question that gives all the relevant information so we can avoid wasting our good intentions and precious time (ta Jason :)). Anyway, back to my day job. Where did I leave my scythe... -- Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
* and then Jim Grill declared Guys, while we may be able to debate what is rude, what is blunt, what should have been said, what was said, the facts are clear. He apologized, and I think its time to lest this debate rest for now. While I would admit that harshness runs rampid on this list, there are times that maybe it is in order. If that time is now or not is a moot point at the moment. Let's get back to peaceful exchange of PHP pleasantries. -Dan Joseph Very nicely said, Dan. I'm with you. :-) PHP is pleasant. I can abide by that ;-) -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
On Friday 03 September 2004 02:23, Nick Wilson wrote: * and then Jason Wong declared - now re-read what I said. I rest my case. Classic. Thankyou Jason, you're a star. I really didnt apreciate just how inept at interaction with peers you truly were. Beautiful, very kind of you to share your wit and comprehension with us all. Troll somewhere else. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* If you can't beat them, join them, then beat them -- Anti- Murphy's Laws n7 */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
Just shows your IQ levels. Just because PHP is open source does not make this an open source. Justin Palmer wrote: Is PHP not open source. What a joke. Justin -Original Message- From: raditha dissanayake [mailto:[EMAIL PROTECTED] Sent: Thursday, September 02, 2004 10:24 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Regex for Validating URL Justin Palmer wrote: I agree Nick for an open source community this list is not very open. Quite a few I am better than you type people on the list. This is not an open source list. this is a php list. -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 128 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
* and then raditha dissanayake declared Just shows your IQ levels. Just because PHP is open source does not make this an open source. I think he was talking about the 'spirit' of open source, not the mechanics and legalities of the list. I know i was, so dont assume please... -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regex for Validating URL
On 02 September 2004 19:41, Nick Wilson wrote: You know guys? I think you all take this a bit too seriously, perdanticness (is there such a word?) Just to be pedantic, that would be pedantry ;) ! Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regex for Validating URL
Just to be pedantic, that would be pedantry ;) ! Is this thread ever going to die? Or would that be dye? ;) alex hogan * The contents of this e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. The views stated herein do not necessarily represent the view of the company. If you are not the intended recipient of this e-mail you may not copy, forward, disclose, or otherwise use it or any part of it in any form whatsoever. If you have received this e-mail in error please e-mail the sender. * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
On Thu, 2 Sep 2004 10:59:20 +0200, Nick Wilson [EMAIL PROTECTED] wrote: yeah, i know, i did do quite a bit of searching but I just cant find it... Does anyone have the regex to make sure an http address is full and without error? like http://www.example.com A quick google (php regex validate url) found this... http://www.canowhoopass.com/guides/regex/ -- Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
* and then Stut declared Does anyone have the regex to make sure an http address is full and without error? like http://www.example.com A quick google (php regex validate url) found this... http://www.canowhoopass.com/guides/regex/ Yes, i saw that page. As I said, I have searched *a lot* for this. That is a bit overkill for me, i just want to validate the syntax of a regular http address. I tried reading the code to extract the needed portion but couldnt work it out ;( Anyone help me out? Thanks.. -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
On Thursday 02 September 2004 18:42, Nick Wilson wrote: * and then Stut declared Does anyone have the regex to make sure an http address is full and without error? like http://www.example.com Define FULL and WITHOUT ERROR. Without knowing what *you* mean by full without error, I don't think anybody can sensibly help you. For instance for the above example you don't even need a regex: if ($url === 'http://www.example.com') { echo 'Yay!, full and without error!'; } I've a feeling that's not what you want, so tell us what you want. A quick google (php regex validate url) found this... http://www.canowhoopass.com/guides/regex/ Yes, i saw that page. As I said, I have searched *a lot* for this. That is a bit overkill for me, It would be nice when asking a question to summarise what research you have done. Instead of just saying I've looked and found nothing (or words to that effect). -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Heisengberg might have been here. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
From: Nick Wilson [EMAIL PROTECTED] Does anyone have the regex to make sure an http address is full and without error? like http://www.example.com (?:http://(?:(?:(?:(?:(?:[a-zA-Z\d](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?)\. )*(?:[a-zA-Z](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?))|(?:(?:\d+)(?:\.(?:\d+) ){3}))(?::(?:\d+))?)(?:/(?:(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-fA-F \d]{2}))|[;:@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:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-f A-F\d]{2}))+))*)?)(?:\?(?:base|one|sub)(?:\?(?:((?:[a-zA-Z\d$\-_.+!*'( ),;/?:@=]|(?:%[a-fA-F\d]{2}))+)))?)?)?)|(?:(?:z39\.50[rs])://(?:(?:(? :(?:(?:[a-zA-Z\d](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?)\.)*(?:[a-zA-Z](?:(?
Re: [PHP] Regex for Validating URL
John Holmes wrote: From: Nick Wilson [EMAIL PROTECTED] Does anyone have the regex to make sure an http address is full and without error? like http://www.example.com (?:http://(?:(?:(?:(?:(?:[a-zA-Z\d](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?)\. )*(?:[a-zA-Z](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?))|(?:(?:\d+)(?:\.(?:\d+) ){3}))(?::(?:\d+))?)(?:/(?:(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-fA-F \d]{2}))|[;:@=])*)(?:/(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-fA-F\d]{ 2}))|[;:@=])*))*)(?:\?(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-fA-F\d]{ 2}))|[;:@=])*))?)?)|(?:ftp://(?:(?:(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(? :%[a-fA-F\d]{2}))|[;?=])*)(?::(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a- fA-F\d]{2}))|[;?=])*))?@)?(?:(?:(?:(?:(?:[a-zA-Z\d](?:(?:[a-zA-Z\d]|- )*[a-zA-Z\d])?)\.)*(?:[a-zA-Z](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?))|(?:(? :\d+)(?:\.(?:\d+)){3}))(?::(?:\d+))?))(?:/(?:(?:(?:(?:[a-zA-Z\d$\-_.+! *'(),]|(?:%[a-fA-F\d]{2}))|[?:@=])*)(?:/(?:(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57][Aa\d]))|(?:%20))+|(?:OID|o id)\.(?:(?:\d+)(?:\.(?:\d+))*))(?:(?:%0[Aa])?(?:%20)*)=(?:(?:%0[Aa])?( ?:%20)*))?(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-fA-F\d]{2}))*))(?:(?:(?: %0[Aa])?(?:%20)*)\+(?:(?:%0[Aa])?(?:%20)*)(?:(?:(?:(?:(?:[a-zA-Z\d]|%( ?:3\d|[46][a-fA-F\d]|[57][Aa\d]))|(?:%20))+|(?:OID|oid)\.(?:(?:\d+)(?: \.(?:\d+))*))(?:(?:%0[Aa])?(?:%20)*)=(?:(?:%0[Aa])?(?:%20)*))?(?:(?:[a -zA-Z\d$\-_.+!*'(),]|(?:%[a-fA-F\d]{2}))*)))*))*(?:(?:(?:%0[Aa])?(?:%2 0)*)(?:[;,])(?:(?:%0[Aa])?(?:%20)*))?)(?:\?(?:(?:(?:(?:[a-zA-Z\d$\-_.+ !*'(),]|(?:%[a-fA-F\d]{2}))+)(?:,(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-f A-F\d]{2}))+))*)?)(?:\?(?:base|one|sub)(?:\?(?:((?:[a-zA-Z\d$\-_.+!*'( ),;/?:@=]|(?:%[a-fA-F\d]{2}))+)))?)?)?)|(?:(?:z39\.50[rs])://(?:(?:(? :(?:(?:[a-zA-Z\d](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?)\.)*(?:[a-zA-Z](?:(?
Re: [PHP] Regex for Validating URL
On Thursday 02 September 2004 20:52, John Holmes wrote: From: Nick Wilson [EMAIL PROTECTED] Does anyone have the regex to make sure an http address is full and without error? like http://www.example.com (?:http://(?:(?:(?:(?:(?:[a-zA-Z\d](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?)\. )*(?:[a-zA-Z](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?))|(?:(?:\d+)(?:\.(?:\d+) [snip] Did you just pulled it out of your ***[1] or did you copy-n-paste it from somewhere? [1] hat -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Life would be tolerable but for its amusements. -- G.B. Shaw */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
* and then Jason Wong declared It would be nice when asking a question to summarise what research you have done. Instead of just saying I've looked and found nothing (or words to that effect). bugger off jason, if you dont understand the question dont bore me with your silliness. -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
* and then John Holmes declared From: Nick Wilson [EMAIL PROTECTED] Does anyone have the regex to make sure an http address is full and without error? like http://www.example.com (?:http://(?:(?:(?:(?:(?:[a-zA-Z\d](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?)\. Pretty funny John. apart from a good laugh, what does that do? ;-) All i want is to check that the url is valid. IE that it does not read like this for example htt://www.example.com or http://[EMAIL PROTECTED] -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
On Thursday 02 September 2004 21:08, John Nichel wrote: What about NFS mounts? ;) What about them? Look carefully. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* You will not be elected to public office this year. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
* and then John Nichel declared John Holmes wrote: From: Nick Wilson [EMAIL PROTECTED] Does anyone have the regex to make sure an http address is full and without error? like http://www.example.com (?:http://(?:(?:(?:(?:(?:[a-zA-Z\d](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?)\. )*(?:[a-zA-Z](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\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:%2 0)*)(?:[;,])(?:(?:%0[Aa])?(?:%20)*))?)(?:\?(?:(?:(?:(?:[a-zA-Z\d$\-_.+ !*'(),]|(?:%[a-fA-F\d]{2}))+)(?:,(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-f A-F\d]{2}))+))*)?)(?:\?(?:base|one|sub)(?:\?(?:((?:[a-zA-Z\d$\-_.+!*'(
RE: [PHP] Regex for Validating URL
[snip] * and then Jason Wong declared It would be nice when asking a question to summarise what research you have done. Instead of just saying I've looked and found nothing (or words to that effect). bugger off jason, if you dont understand the question dont bore me with your silliness. [/snip] Easy gentlemen...easy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
From: Jason Wong [EMAIL PROTECTED] Does anyone have the regex to make sure an http address is full and without error? like http://www.example.com (?:http://(?:(?:(?:(?:(?:[a-zA-Z\d](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?)\. )*(?:[a-zA-Z](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?))|(?:(?:\d+)(?:\.(?:\d+) [snip] Did you just pulled it out of your ***[1] or did you copy-n-paste it from somewhere? Some best of the internet site... I had to pull it from the Google cache since work wouldn't let me get to the site. I don't even know if it really works or not... :) ---John Holmes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
From: Nick Wilson [EMAIL PROTECTED] * and then Jason Wong declared It would be nice when asking a question to summarise what research you have done. Instead of just saying I've looked and found nothing (or words to that effect). bugger off jason, if you dont understand the question dont bore me with your silliness. I couldn't agree more. You're here to answer questions, Jason. You do the research and put the time into finding answer for me because I'm too fucking lazy to do it. You can't expect me to provide useful information in my questions. That's for me to know and for you to pry out of me over the course of 20 emails only to determine that wait, you have to install PHP?... Got it? Seriously, I hope you were being sarcastic or something, Nick. Otherwise the smart people on the list know how to use filters to tune out idiots. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
* and then Jay Blanchard declared Easy gentlemen...easy Fair play Jay. This is not my first encounter with mr.social.skills though ;-) -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
* and then John Holmes declared Seriously, I hope you were being sarcastic or something, Nick. Otherwise the smart people on the list know how to use filters to tune out idiots. I think it's a clear question. I dread coming to this list in case Jason decides to 'tell me off' for somthing. I really wish he'd put me on his 'ignore list'. -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
* and then John Holmes declared From: Nick Wilson [EMAIL PROTECTED] * and then Jason Wong declared besides, i will not be treated that way by anyone without saying somthing. IMO some on this list need to get out a bit more, meet some people, aquire some manners and social skills. I asked the same quesiton elsewhere and got 2 answers with exactly what i needed. Nobody asked anybody to any research/homework for them, i just hoped someone might have it handy and be happy to post it. thanks.. -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
Nick Wilson wrote: * and then Jason Wong declared It would be nice when asking a question to summarise what research you have done. Instead of just saying I've looked and found nothing (or words to that effect). bugger off jason, if you dont understand the question dont bore me with your silliness. Nice. Maybe if you took the time out of your busy day to actually look for a solution, Jason would have to 'bore' you. Here... http://www.google.com/search?hl=enie=UTF-8q=validate+url+php+regular+expressionbtnG=Google+Search Is that enough, or do you want one of us to write the code for you too? -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
Jason Wong wrote: On Thursday 02 September 2004 21:08, John Nichel wrote: What about NFS mounts? ;) What about them? Look carefully. I don't know if I have that much time. :) -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
On 02/09/2004, at 11:27 PM, Nick Wilson wrote: * and then Jason Wong declared It would be nice when asking a question to summarise what research you have done. Instead of just saying I've looked and found nothing (or words to that effect). bugger off jason, if you dont understand the question dont bore me with your silliness. No, Jason was right (in his usual, abrupt, rude kinda way). Good questions get good answers. --- Justin French http://indent.com.au -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
Jay Blanchard wrote: Easy gentlemen...easy Who you callin' a gentleman?!?! -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
* and then Justin French declared On 02/09/2004, at 11:27 PM, Nick Wilson wrote: * and then Jason Wong declared It would be nice when asking a question to summarise what research you have done. Instead of just saying I've looked and found nothing (or words to that effect). bugger off jason, if you dont understand the question dont bore me with your silliness. No, Jason was right (in his usual, abrupt, rude kinda way). Good questions get good answers. It seems I owe Jason an apology. Jason, i apologize. No buts, no becauses, I went a little too far. I'm sorry. I would take it as a kindness though if you would avoid my posts where possible. thankyou. -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
I have taken a look and I have seen a {3} and I think this was for specifying the number of letters of the top domain name. Well, I think it should be {4} for making it work for .info domains also... T Teddy - Original Message - From: John Holmes [EMAIL PROTECTED] To: Jason Wong [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, September 02, 2004 4:56 PM Subject: Re: [PHP] Regex for Validating URL From: Jason Wong [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
On Thursday 02 September 2004 22:10, Nick Wilson wrote: * and then John Holmes declared Seriously, I hope you were being sarcastic or something, Nick. Otherwise the smart people on the list know how to use filters to tune out idiots. I think it's a clear question. I dread coming to this list in case Jason decides to 'tell me off' for somthing. I really wish he'd put me on his 'ignore list'. OK Prince Charming, this will probably be my last response to you. - You preface your question by saying that you already did some research. - Stut suggests a site to you - You say you already looked at that site, you just wasted Stut's good intentions and precious time - John gives you a very comprehensive regex, but apparently its too comprehensive for you -- John doesn't mind wasting time ;) - now re-read what I said. I rest my case. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Justice always prevails ... three times out of seven! -- Michael J. Wagner */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regex for Validating URL
I agree Nick for an open source community this list is not very open. Quite a few I am better than you type people on the list. How does that make the beginner feel? I better not ask a question, for I fear that I will get flamed. What a joke! There are many other places to go and get good answers without the bull shit that you get here. Regards, Justin -Original Message- From: Nick Wilson [mailto:[EMAIL PROTECTED] Sent: Thursday, September 02, 2004 7:15 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Regex for Validating URL * and then John Holmes declared From: Nick Wilson [EMAIL PROTECTED] * and then Jason Wong declared besides, i will not be treated that way by anyone without saying somthing. IMO some on this list need to get out a bit more, meet some people, aquire some manners and social skills. I asked the same quesiton elsewhere and got 2 answers with exactly what i needed. Nobody asked anybody to any research/homework for them, i just hoped someone might have it handy and be happy to post it. thanks.. -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regex for Validating URL
Maybe what this community needs is an advanced mailing list. I think that these types of attitudes just make the new user to php stray away. If we had a section beginners list that if people asked dumb questions, or questions that are stated dumb, some people would take the time to help the newbie out and show him the right way and then answer his question for him. This way the Arrogants don't have to be in the newbie list and people that are more down to earth can help the php community grow. My 2 cents. Regards, Justin -Original Message- From: Justin French [mailto:[EMAIL PROTECTED] Sent: Thursday, September 02, 2004 7:16 AM To: Nick Wilson Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Regex for Validating URL On 02/09/2004, at 11:27 PM, Nick Wilson wrote: * and then Jason Wong declared It would be nice when asking a question to summarise what research you have done. Instead of just saying I've looked and found nothing (or words to that effect). bugger off jason, if you dont understand the question dont bore me with your silliness. No, Jason was right (in his usual, abrupt, rude kinda way). Good questions get good answers. --- Justin French http://indent.com.au -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
* Thus wrote Nick Wilson: * and then John Holmes declared From: Nick Wilson [EMAIL PROTECTED] Does anyone have the regex to make sure an http address is full and without error? like http://www.example.com (?:http://(?:(?:(?:(?:(?:[a-zA-Z\d](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?)\. Pretty funny John. apart from a good laugh, what does that do? ;-) All i want is to check that the url is valid. IE that it does not read like this for example htt://www.example.com or http://[EMAIL PROTECTED] Both of those are perfectly valid. Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
On Thursday 02 September 2004 22:15, Justin French wrote: No, Jason was right (in his usual, abrupt, rude kinda way). abrupt -- maybe, rude -- no I usually reserve my more elegant prose for my sweetheart. Good questions get good answers. Good advice. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* If you can't get your work done in the first 24 hours, work nights. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
Hello, From: Nick Wilson [EMAIL PROTECTED] Does anyone have the regex to make sure an http address is full and without error? like http://www.example.com Usually I use this expression: '^(http|https)\://(([-!#\$%\'*+.0-9=?A-Z^_`a-z{|}~^?]+\.)+[A-Za-z]{2,6})(\:[0-9]+)?(/)?/' You may also want to try this forms generation and validation class that comes with special URL auto-completion field support so you can do for instance simply type www.php.net and it automatically expand to http://www.php.net/ and conform to a more strict validation expression like the above without making the user type it all. http://www.phpclasses.org/formsgeneration -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
Justin Palmer wrote: I agree Nick for an open source community this list is not very open. Quite a few I am better than you type people on the list. This is not an open source list. this is a php list. -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 128 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
Justin Palmer wrote: I agree Nick for an open source community this list is not very open. Quite a few I am better than you type people on the list. This list is tame Justin. How does that make the beginner feel? I better not ask a question, for I fear that I will get flamed. What a joke! How does a beginner know that a stupid question will get them flamed? They are beginners afterall. There are many other places to go and get good answers without the bull shit that you get here. Hmmm...since the grass is greener in those many other places, why do they (you) come here? -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regex for Validating URL OT
[snip] I agree Nick for an open source community this list is not very open. Quite a few I am better than you type people on the list. How does that make the beginner feel? I better not ask a question, for I fear that I will get flamed. What a joke! There are many other places to go and get good answers without the bull shit that you get here. [/snip] Feeling a little high and mighty there Justin? If you get better answers somewhere else then the general advice would be to go there regularly. There are several fine folks here who spend a lot of time helping. And you have to admit, because you have been here for a while, that there are several questions repeated over and over, questions that do not make sense, questions that have not been researched at all, etc., etc., etc. Those who have received help here, including yourself, have been grateful. Those who have dispensed help here, including yourself, have been happy to do so. However, your post above would be a pot calling the kettle black as it is full of judgemental schmegma which is just not required. These little flame wars crop up from time-to-time and then everyone settles down. Personal attacks, such as the one posted earlier, have no place on what is ostensibly a self-policed' list. My advice, if you don't like it here and don't feel compelled to help others, don't let the header hit you on your ass on the way out. Other than that, continuuing a flame war that had all but ceased is way out of line on your part. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regex for Validating URL
Is PHP not open source. What a joke. Justin -Original Message- From: raditha dissanayake [mailto:[EMAIL PROTECTED] Sent: Thursday, September 02, 2004 10:24 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Regex for Validating URL Justin Palmer wrote: I agree Nick for an open source community this list is not very open. Quite a few I am better than you type people on the list. This is not an open source list. this is a php list. -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 128 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
On Thursday 02 September 2004 23:17, Justin Palmer wrote: Maybe what this community needs is an advanced mailing list. Arguments for and against splitting lists (in general and not just php lists) into 'newbie' and 'advanced' can be found all over the web. I think that these types of attitudes just make the new user to php stray away. If we had a section beginners list that if people asked dumb questions, or questions that are stated dumb, some people would take the time to help the newbie out and show him the right way and then answer his question for him. What, asking further questions to clarify exactly what it is that someone is asking (as opposed to what that someone thinks s/he is asking) is being ... This way the Arrogants don't have to be in the newbie list and people that are more down to earth can help the php community grow. ... arrogant? If that's arrogant then I don't mind being your definition of arrogant. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Time-sharing is the junk-mail part of the computer business. -- H.R.J. Grosch (attributed) */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
From: Justin Palmer [EMAIL PROTECTED] Maybe what this community needs is an advanced mailing list. I think that these types of attitudes just make the new user to php stray away. If we had a section beginners list that if people asked dumb questions, or questions that are stated dumb, some people would take the time to help the newbie out and show him the right way and then answer his question for him. This way the Arrogants don't have to be in the newbie list and people that are more down to earth can help the php community grow. Is it that time of the year again for this discussion? Who determines advanced vs. newbie? Do new users know whether they are asking an advanced or easy question? If they're new and they don't know the answer, it's probably advanced to them. This whole concern over the mean guys of the list is hilarious. If you get all bent out of shape over what a couple guys might say to you over email, you've got issues. I think this list has gotten better over the past year and we've gotten rid of the repetitive newbie and off-topic questions by the persistent enforcement of certain guidelines (not rules, because in the end, there are none). I don't know what camp most of you consider me in and it doesn't really matter. I try to help everyone I can. Sometimes I give well thought out answers, sometimes I'm in a bad mood and will give a RTFM type answer and sometimes I just post complete bullshit. It's up to me and me alone. :) ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
Justin Palmer wrote: Maybe what this community needs is an advanced mailing list. Don't mean to be arrogant but this has been discussed before :-) please refer to the newby guide on how to search the archives. I know many of you will think some contributers are arrogant. But the truth is you will find that these arrogants are the ones who are giving the most usefull answers most of the time. They have a very short temper with people who do not bother to read the newby guide before posting. -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 128 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regex for Validating URL OT
At the time I had sent the email it was right in line with what was going on at the time. Sorry if the message did not get through in a timely matter. I just think that if someone has the time to give a snide remark then they have the time to do it in a nice way, or just don't respond. If people don't respond then the person will do more research or find another way. And I am not just talking about this one item. All over the list there are mighty people, and that goes the same for life. I love this list, I like to read and reason peoples problems and see what others are doing. I would never leave. Maybe the list signature at the bottom should include a line that talks about checking the archives with a link, maybe that would help. Enough said. Justin Happy, Happy. Joy, Joy. All is well. -Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED] Sent: Thursday, September 02, 2004 10:16 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] Regex for Validating URL OT [snip] I agree Nick for an open source community this list is not very open. Quite a few I am better than you type people on the list. How does that make the beginner feel? I better not ask a question, for I fear that I will get flamed. What a joke! There are many other places to go and get good answers without the bull shit that you get here. [/snip] Feeling a little high and mighty there Justin? If you get better answers somewhere else then the general advice would be to go there regularly. There are several fine folks here who spend a lot of time helping. And you have to admit, because you have been here for a while, that there are several questions repeated over and over, questions that do not make sense, questions that have not been researched at all, etc., etc., etc. Those who have received help here, including yourself, have been grateful. Those who have dispensed help here, including yourself, have been happy to do so. However, your post above would be a pot calling the kettle black as it is full of judgemental schmegma which is just not required. These little flame wars crop up from time-to-time and then everyone settles down. Personal attacks, such as the one posted earlier, have no place on what is ostensibly a self-policed' list. My advice, if you don't like it here and don't feel compelled to help others, don't let the header hit you on your ass on the way out. Other than that, continuuing a flame war that had all but ceased is way out of line on your part. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
* and then Jason Wong declared - now re-read what I said. I rest my case. Classic. Thankyou Jason, you're a star. I really didnt apreciate just how inept at interaction with peers you truly were. Beautiful, very kind of you to share your wit and comprehension with us all. -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
From: Jason Wong [EMAIL PROTECTED] I usually reserve my more elegant prose for my sweetheart. Please stop call me that... it creeps me out. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
* and then John Holmes declared Who determines advanced vs. newbie? I think that's another discussion. mean guys You belittle the point. It's not about hurt feelings, it about respect for other people and common courtesty: The cornerstones of community. I dont have a problem with everyone assuming im new to php, it really wasnt the best question was it? ;-) I'll never be a genius programmer because a) i have another agenda, b) im probably not clever enough. The fact that im not a genius programmer should not be rammed down my throat by an egotistical half wit. (names have been changed to protect the innocent). The open source community is an awesome thing, but it can breed elitism just as quick as any other 'society'. So chill the fuck out and be nice okay` -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
* and then John Nichel declared http://www.google.com/search?hl=enie=UTF-8q=validate+url+php+regular+expressionbtnG=Google+Search Is that enough, or do you want one of us to write the code for you too? You misunderstand me. Im sorry you feel that way. I'll have a look at it now, thanks -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regex for Validating URL
Ahem... No, Jason was right (in his usual, abrupt, rude kinda way). Guys, while we may be able to debate what is rude, what is blunt, what should have been said, what was said, the facts are clear. He apologized, and I think its time to lest this debate rest for now. While I would admit that harshness runs rampid on this list, there are times that maybe it is in order. If that time is now or not is a moot point at the moment. Let's get back to peaceful exchange of PHP pleasantries. -Dan Joseph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
* and then Manuel Lemos declared Does anyone have the regex to make sure an http address is full and without error? like http://www.example.com Usually I use this expression: '^(http|https)\://(([-!#\$%\'*+.0-9=?A-Z^_`a-z{|}~^?]+\.)+[A-Za-z]{2,6})(\:[0-9]+)?(/)?/' DING DING DING!! Ladies and gentleman, i think we have a winner! ;-) You know guys? I think you all take this a bit too seriously, perdanticness (is there such a word?) is all well and good for an FBI agent but I stand by the claim that my original question really was rather simple. Thanks Manuel, I have it working already but that looks remarkably similar to the one I have, im sure it's the same ;-) thanks again... -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL OT
[snip] I agree Nick for an open source community this list is not very open. Quite a few I am better than you type people on the list. How does that make the beginner feel? I better not ask a question, for I fear that I will get flamed. What a joke! There are many other places to go and get good answers without the bull shit that you get here. [/snip] Feeling a little high and mighty there Justin? If you get better answers somewhere else then the general advice would be to go there regularly. There are several fine folks here who spend a lot of time helping. And you have to admit, because you have been here for a while, that there are several questions repeated over and over, questions that do not make sense, questions that have not been researched at all, etc., etc., etc. Those who have received help here, including yourself, have been grateful. Those who have dispensed help here, including yourself, have been happy to do so. However, your post above would be a pot calling the kettle black as it is full of judgemental schmegma which is just not required. These little flame wars crop up from time-to-time and then everyone settles down. Personal attacks, such as the one posted earlier, have no place on what is ostensibly a self-policed' list. My advice, if you don't like it here and don't feel compelled to help others, don't let the header hit you on your ass on the way out. Other than that, continuuing a flame war that had all but ceased is way out of line on your part. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
* and then Justin Palmer declared Is PHP not open source. What a joke. agreed, that was ridiculous. -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
John Holmes wrote: I don't know what camp most of you consider me in and it doesn't really matter. Summer's over. School's back in. What are you still doing at camp? ;) -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
Would this be a good time to bring up the argument in favour of freedom to top post? Ducking and running, Rob. On Thu, 2004-09-02 at 13:34, John Holmes wrote: From: Justin Palmer [EMAIL PROTECTED] Maybe what this community needs is an advanced mailing list. I think that these types of attitudes just make the new user to php stray away. If we had a section beginners list that if people asked dumb questions, or questions that are stated dumb, some people would take the time to help the newbie out and show him the right way and then answer his question for him. This way the Arrogants don't have to be in the newbie list and people that are more down to earth can help the php community grow. Is it that time of the year again for this discussion? Who determines advanced vs. newbie? Do new users know whether they are asking an advanced or easy question? If they're new and they don't know the answer, it's probably advanced to them. This whole concern over the mean guys of the list is hilarious. If you get all bent out of shape over what a couple guys might say to you over email, you've got issues. I think this list has gotten better over the past year and we've gotten rid of the repetitive newbie and off-topic questions by the persistent enforcement of certain guidelines (not rules, because in the end, there are none). I don't know what camp most of you consider me in and it doesn't really matter. I try to help everyone I can. Sometimes I give well thought out answers, sometimes I'm in a bad mood and will give a RTFM type answer and sometimes I just post complete bullshit. It's up to me and me alone. :) ---John Holmes... -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
Ahem... No, Jason was right (in his usual, abrupt, rude kinda way). Guys, while we may be able to debate what is rude, what is blunt, what should have been said, what was said, the facts are clear. He apologized, and I think its time to lest this debate rest for now. While I would admit that harshness runs rampid on this list, there are times that maybe it is in order. If that time is now or not is a moot point at the moment. Let's get back to peaceful exchange of PHP pleasantries. -Dan Joseph Very nicely said, Dan. I'm with you. :-) PHP is pleasant. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
Nick Wilson wrote: So chill the fuck out and be nice okay` I'll do you one better, and just filter you outhow's that? And when you say something like this to one of the most respected (not to mention one of the nicest) members of this list, I'm sure I won't be the only one. Welcome to /dev/null; hope you enjoy your stay. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex for Validating URL
* Thus wrote Nick Wilson: * and then Manuel Lemos declared Does anyone have the regex to make sure an http address is full and without error? like http://www.example.com Usually I use this expression: '^(http|https)\://(([-!#\$%\'*+.0-9=?A-Z^_`a-z{|}~^?]+\.)+[A-Za-z]{2,6})(\:[0-9]+)?(/)?/' DING DING DING!! Ladies and gentleman, i think we have a winner! ;-) um.. ok.. i guess you consider http://?#.zz/ a full url without error. This answer could have been easily answered if you simply answered the question that wanted to know this. You know guys? I think you all take this a bit too seriously, perdanticness (is there such a word?) is all well and good for an FBI agent but I stand by the claim that my original question really was rather simple. No its not that simple, unless you have the magical 8 ball: http://woohoo/ http://[EMAIL PROTECTED]/ http://foo:[EMAIL PROTECTED]/ http://port.deprived:8230/ http://another-one-bites-the-dust.com/ http://forever_we_could.go-but.not-done.com/ http://another.one.so.where/at/a/location/ http://a.sub.domain.crazy.person.com/ ftp://woah.switch.protocols.on.us.com/ myown://custom.protocol.or-could.be-any_standard.whatchamacallit/ http://neverneverland:842/~chickensrule/ file://c:/windows/hatred.ini So which one is full and without error? Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex to remove NL and CR
Hi, Wednesday, August 18, 2004, 9:09:02 AM, you wrote: KB I am extracting text from a text datatype field of a KB database. The target text is marked (beginning and KB end) by html comments that have a known--but not KB uniform--format. Unfortunately, the web-based KB interface used to maintain the data inserted hard line KB breaks in the text. KB I initially tried removing all NL and CR chars from KB the string, which has the unanticipated result of KB removing some spaces between words that had wrapped in KB the admin interface. KB Now, I need to remove all NL and CR that occur within KB a string starting with !- and ending with -. I KB have no idea where to start, because the NL and CR KB could also occur in the strings that mark the start KB and end of the comments. KB I am very new to regex, but starting to get it. If KB someone could just give me a push in the right KB direction. Nothing I have tested in regex coach comes KB close to matching what I need. KB Kathleen This is probably quicker using a callback function like this: $string = !-- a\nlong\rtest\n\rstring --; echo nl2br(htmlentities($string)); echo 'br'; function replace($str){ return preg_replace('/\n\r|\n|\r/',' ',$str[0]); } $newstring = preg_replace_callback('/!--(.*?)--/s','replace',$string); echo nl2br(htmlentities($newstring)); -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex help
Can you post a little sample of the data and your current code? thanks. Jim Grill Web-1 Hosting http://www.web-1hosting.net - Original Message - From: Kathleen Ballard [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, August 01, 2004 8:27 AM Subject: [PHP] regex help I am at the tailend of a project that involves moving legacy data from one dbms to another. The client has added a new requirement to the data manipulation that is required. I need to remove all br / tags (there may be more that one) that appear within all h* tags. I am not very familiar with building regular expressions, but I see this as a 2 part process. First, to grab h* tags, and second, to strip the br's. I can grab the beginning of the tag easily, but my expressions grab too much. Also, I am not sure how to remove the br's. Any help would be appreciated. I have tried to find similar examples, but without any luck. Also, php5 is not an option at this point. Kathleen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex help
On Sun, 1 Aug 2004 06:27:51 -0700 (PDT), Kathleen Ballard [EMAIL PROTECTED] wrote: I am at the tailend of a project that involves moving legacy data from one dbms to another. The client has added a new requirement to the data manipulation that is required. I need to remove all br / tags (there may be more that one) that appear within all h* tags. I am not very familiar with building regular expressions, but I see this as a 2 part process. First, to grab h* tags, and second, to strip the br's. I can grab the beginning of the tag easily, but my expressions grab too much. Also, I am not sure how to remove the br's. Any help would be appreciated. I have tried to find similar examples, but without any luck. Also, php5 is not an option at this point. $text = preg_replace('!(h\d[^]*.*?)br/(.*?/h\d)!is', '\1\2', $text); You may also have to do this several times as this will only get one br per h tag. $newText = $text; do { $text = $newText; $newText = preg_replace('!(h\d[^]*.*?)br/(.*?/h\d)!is', '\1\2', $text); } while($text != $newText); Kathleen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex help
Forget my first attempt, using the e modifier and another preg_replace is much better. $return = preg_replace('!h(\d)(.*?)/h\1!ie', 'preg_replace(!br[^]*!i, , $1)', $originalText); On Sun, 1 Aug 2004 13:39:49 -0700, Justin Patrin [EMAIL PROTECTED] wrote: On Sun, 1 Aug 2004 06:27:51 -0700 (PDT), Kathleen Ballard [EMAIL PROTECTED] wrote: I am at the tailend of a project that involves moving legacy data from one dbms to another. The client has added a new requirement to the data manipulation that is required. I need to remove all br / tags (there may be more that one) that appear within all h* tags. I am not very familiar with building regular expressions, but I see this as a 2 part process. First, to grab h* tags, and second, to strip the br's. I can grab the beginning of the tag easily, but my expressions grab too much. Also, I am not sure how to remove the br's. Any help would be appreciated. I have tried to find similar examples, but without any luck. Also, php5 is not an option at this point. $text = preg_replace('!(h\d[^]*.*?)br/(.*?/h\d)!is', '\1\2', $text); You may also have to do this several times as this will only get one br per h tag. $newText = $text; do { $text = $newText; $newText = preg_replace('!(h\d[^]*.*?)br/(.*?/h\d)!is', '\1\2', $text); } while($text != $newText); Kathleen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex help needed
On Sun, 1 Aug 2004 10:38:06 -0700 (PDT) Kathleen Ballard [EMAIL PROTECTED] wrote: Sorry, Here is the code I am using to match the h* tags: h([1-9]){1}.*/h([1-9]){1} I have removed all the NL and CR chars from the string I am matching to make things easier. Also, I have run tidy on the code so the tags are all uniform. The above string seems to match the tag well now, but I still need to remove the br tags from the tag contents (.*). The strings I will be matching are html formatted text. Sample h* tags with content are below: h4Ex-Secretary Mickey Mouse br /Loses Mass. Primary/h4 h4Ex-Secretary Mickey Mouse br /Loses Mass. Primary br / Wins New Jersey/h4 h4Ex-Secretary Reich Loses Mass. Primary/h4 Again, any help is appreciated. Kathleen Simple: while (preg_match(/(h\d)(.*)(br \/)(.*)(\/h\d)/is, $str)) { $str = preg_replace(/(h\d)(.*)(br \/)(.*)(\/h\d)/is, $1$2$4$5, $str); } $str = preg_replace(/(h\d)(.*)(\/h\d)/is, $2, $str); Recommended: $str = preg_replace(/(h\d)([^]*)()(.*)(\/h\d)/eis, remove_br('$4'), $str); function remove_br($str){ return preg_replace(/(br)([^]*)()/i, , $str); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex (Phone Number)
Albert Padley wrote: I have been struggling with a javascript regex validation for U.S. phone This is a PHP list. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex (Phone Number)
* Thus wrote Albert Padley: I have been struggling with a javascript regex validation for U.S. phone numbers all afternoon. This is part of Manuel Lemos' Formsgen class. This is limited to the 7 digit number sans 3 digit area code. To be complete, the regex should disallow a phone number that begins with 0 or 1, 555 or any digit followed by 11. Here is the regex I'm using: ^(?!\d[1]{2}|[5]{3})([2-9]\d{2})([-])\d{4}$ start yourself in a controlled environment, instead of trying to comeup with the endless ways a number can be formated and remove all non digits, then simply test the condistion of the string if substr(0,1) == 0 || substr(0,1) == 1 fail if substr(0,3) == 555 fail if substr(1,2) == 11 fail if strlen != 7 fail Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex problem
On Thu, 1 Jul 2004 16:41:50 -0500, Josh Close [EMAIL PROTECTED] wrote: I'm trying to get a simple regex to work. Here is the test script I have. #!/usr/bin/php -q ? $string = hello\nworld\n; $string = preg_replace(/[^\r]\n/i,\r\n,$string); $string = preg_replace(/([^\r])\n/i,\\1\r\n,$string); You could also use forward look-aheads, but I don't remember how to do that right now. $string = addcslashes($string, \r\n); print $string; ? This outputs hell\r\nworl\r\n so it's removing the char before the \n also. I just want it to replace a lone \n with \r\n -Josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php !DSPAM:40e48327189276451316304! -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php