Re: [PHP] Regex for email validation

2008-08-30 Thread Per Jessen
Per Jessen wrote: > tedd wrote: > >> But as it is now, it's not so much IF the domain name is easy to >> type in or not, but rather does the Rx.com show up in the URL once >> you get there? And it does for most browsers other than IE. >> >> You can get to the site very easily, try typing: >> >

Re: [PHP] Regex for email validation

2008-08-30 Thread Per Jessen
tedd wrote: > But as it is now, it's not so much IF the domain name is easy to > type in or not, but rather does the Rx.com show up in the URL once > you get there? And it does for most browsers other than IE. > > You can get to the site very easily, try typing: > > http://rx-2.com > > That wa

Re: [PHP] Regex for email validation

2008-08-30 Thread Per Jessen
tedd wrote: > However, it's one thing to have a keyboard designed for a specific > language and another to be able to enter code-points that aren't > associated with any specific language (i.e., Dingbats and Math > Symbols). Ah yes, that's true. How about an APL2 keyboard then? :-) > For examp

Re: [PHP] Regex for email validation

2008-08-28 Thread tedd
At 9:34 AM +0200 8/28/08, Per Jessen wrote: Yeti wrote: That Rx.com domain name is really great stuff, but how do you expect the average user to type it in? Sorry, I don't understand the problem. The average user will obviously have a suitable keyboard, such as this for instance: http://

Re: [PHP] Regex for email validation

2008-08-28 Thread tedd
At 9:29 AM +0200 8/28/08, Yeti wrote: That Rx.com domain name is really great stuff, but how do you expect the average user to type it in? Of course the problem has always been how can the user enter these types of characters from their keyboard. But, that's pretty simply with a Mac and as t

Re: [PHP] Regex for email validation

2008-08-28 Thread Per Jessen
Yeti wrote: > That Rx.com domain name is really great stuff, but how do you expect > the average user to type it in? > Sorry, I don't understand the problem. The average user will obviously have a suitable keyboard, such as this for instance: http://en.wikipedia.org/wiki/Image:KB_Swiss.svg /

Re: [PHP] Regex for email validation

2008-08-28 Thread Yeti
That Rx.com domain name is really great stuff, but how do you expect the average user to type it in? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Regex for email validation

2008-08-28 Thread Per Jessen
Kevin Waterson wrote: > There is no silver bullet regex to validate all RFC compliant email > address. Many have tried, but they all fail at some point. The best > you can do is cater to most _sane_ addresses. > Exactly - the regex is a quick/cheap sanity check, nothing more. To go all the way,

Re: [PHP] Regex for email validation

2008-08-28 Thread Per Jessen
tedd wrote: > The WG did solve this issue and came up with a way to do that -- the > current algorithm is called PUNYCODE which allows Unicode code-points > to appear in a domain name. I know this to be true because I have > several domains that lie outside the standard ASCII AND they are real > d

Re: [PHP] Regex for email validation

2008-08-27 Thread mike
Honestly, I'd stick to using php's filter extension. It -should- be the best one out there. If it is not processing something it should, then it's a bug - submit it so all of us benefit :) I am tired of trying to find regexps and all that every time, I put my stock into PHP's core when I can. On

Re: [PHP] Regex for email validation

2008-08-27 Thread Kevin Waterson
This one time, at band camp, Yeti <[EMAIL PROTECTED]> wrote: > # this one worked fine for me, but it does not cover the full RFC > like: "name" [EMAIL PROTECTED] OR name <[EMAIL PROTECTED]> > $regex = > "^[a-z0-9,!#\$%&'\*\+/=\?\^_`\{\|}~-]+(\.[a-z0-9,!#\$%&'\*\+/=\?\^_`\{\|}~-]+)[EMAIL > PROTE

Re: [PHP] Regex for email validation

2008-08-27 Thread tedd
At 8:35 PM +0200 8/27/08, Per Jessen wrote: > So, regardless of the documentation, which may be outdated, I know > that Unicode characters can be used in IDNS and thus on both sides of the @, You're wrong - IDNs only apply to the right side of the @. (check out what the 'D' means). The D

Re: [PHP] Regex for email validation

2008-08-27 Thread tedd
At 8:35 PM +0200 8/27/08, Per Jessen wrote: Go on, send me that email to '[EMAIL PROTECTED]' ... for what it's worth, I can't even define an account like that, so my mailserver might well reject it. Yes, you are right. I was thinking of something else, namely that the LHS of the email address

Re: [PHP] Regex for email validation

2008-08-27 Thread Lupus Michaelis
Per Jessen a écrit : I don't know, but I suspect due to lack of support in popular mailers and mail-servers. Also, the use of quotes does make it cumbersome to work with, both as a user and as a mailserver admin. I had to write some pieace of code that can handle "toto toto"@ndd five year

Re: [PHP] Regex for email validation

2008-08-27 Thread Per Jessen
Lupus Michaelis wrote: > Per Jessen a écrit : > >> That format is about as dead as the dinosaurs. > >Why ? I don't know, but I suspect due to lack of support in popular mailers and mail-servers. Also, the use of quotes does make it cumbersome to work with, both as a user and as a mailserve

Re: [PHP] Regex for email validation

2008-08-27 Thread Lupus Michaelis
Per Jessen a écrit : That format is about as dead as the dinosaurs. Why ? -- Mickaël Wolff aka Lupus Michaelis http://lupusmic.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Regex for email validation

2008-08-27 Thread Per Jessen
tedd wrote: > >>No, they can't. There are no 8-bit characters allowed in an >>email-address. Check out RFC2821. > > You can throw all the facts and documentation you want at me, but the > left side of the @ has always been open to anything you want. Except anything 8-bit, yes. Seriously, r

Re: [PHP] Regex for email validation

2008-08-27 Thread tedd
At 7:55 PM +0200 8/27/08, Lupus Michaelis wrote: mike a écrit : php should have a good check built-in. see http://www.php.net/manual/en/function.filter-var.php Argh ! Howmany times it is in ? I spent so many time to write a regex that belongs the RFC822 :-/ Because all the regex in answe

Re: [PHP] Regex for email validation

2008-08-27 Thread tedd
At 6:30 PM +0200 8/27/08, Per Jessen wrote: Well, I left that for the OP to figure out. Still, your regex is worse - a domain name cannot contain '%'. The only valid characters for a domain name are letters, numbers and a hyphen. Also, maximum length for a domain name is 64 characters, which c

Re: [PHP] Regex for email validation

2008-08-27 Thread Per Jessen
Lupus Michaelis wrote: >Argh ! Howmany times it is in ? I spent so many time to write a >regex > that belongs the RFC822 :-/ Because all the regex in answer here was > false. They don't allow email like "Mickael Doodoo"@lupusmic.com nor That format is about as dead as the dinosaurs. I kn

Re: [PHP] Regex for email validation

2008-08-27 Thread Lupus Michaelis
mike a écrit : php should have a good check built-in. see http://www.php.net/manual/en/function.filter-var.php Argh ! Howmany times it is in ? I spent so many time to write a regex that belongs the RFC822 :-/ Because all the regex in answer here was false. They don't allow email like "Mic

Re: [PHP] Regex for email validation

2008-08-27 Thread Per Jessen
Yeti wrote: > # this one worked fine for me, but it does not cover the full RFC > like: "name" [EMAIL PROTECTED] OR name <[EMAIL PROTECTED]> > $regex = > "^[a-z0-9,!#\$%&'\*\+/=\?\^_`\{\|}~-]+(\.[a-z0-9,!#\$%&'\*\+/=\ \^_`\{\|}~-]+)[EMAIL PROTECTED](\.[a-z0-9-]+)*\.([a-z]{2,})$"; For the domain

Re: [PHP] Regex for email validation

2008-08-27 Thread Per Jessen
tedd wrote: >> >>Option 1: /[EMAIL PROTECTED]/ >> >>This is probably what you meant: >> >>/[EMAIL PROTECTED]/ >> >>/Per Jessen, Zürich > > Which is probably what you meant: > > eregi("[EMAIL PROTECTED],6}$", $email) > > Email comes in different TLD flavors. Well, I left that for the OP to fi

Re: [PHP] Regex for email validation

2008-08-27 Thread Yeti
$regex = "^[a-z0-9,!#\$%&'\*\+/=\?\^_`\{\|}~-]+(\.[a-z0-9,!#\$%&'\*\+/=\?\^_`\{\|}~-]+)[EMAIL PROTECTED](\.[a-z0-9-]+)*\.([a-z]{2,})$"; if (eregi($regex, $email)) { // do something } # Beware that the filter functions only work under PHP5+. If your PHP supports them they should be the preferred

Re: [PHP] Regex for email validation

2008-08-27 Thread tedd
At 9:31 AM +0200 8/27/08, Per Jessen wrote: VamVan wrote: Hello Guys, Does any have a regex for email validation? I need to allow only period and underscore in the local part , we would need a @ and .com or watever for domain. Option 1: /[EMAIL PROTECTED]/ This is probably what you me

Re: [PHP] Regex for email validation

2008-08-27 Thread Richard Heyes
> Does any have a regex for email validation? I need to allow only period and > underscore in the local part , we would need a @ and .com or watever for > domain. You could: 1. Take the isValidInetAddress() method out of the PEAR Mail_RFC822 class and use that. 2. Use the filter extension which I

Re: [PHP] Regex for email validation

2008-08-27 Thread Micah Gersten
That's a very handy extension. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com mike wrote: > > php should have a good check built-in. > > see http://www.php.net/manual/en/function.filter-var.php > > if(!filter_var($var, FILTER_VALIDATE_EMAIL)) { > echo "inv

Re: [PHP] Regex for email validation

2008-08-27 Thread Per Jessen
VamVan wrote: > Hello Guys, > > Does any have a regex for email validation? I need to allow only > period and underscore in the local part , we would need a @ and .com > or watever for domain. Option 1: /[EMAIL PROTECTED]/ This is probably what you meant: /[EMAIL PROTECTED]/ /Per Jessen, Z

Re: [PHP] Regex for email validation

2008-08-27 Thread mike
> On 8/27/08, VamVan <[EMAIL PROTECTED]> wrote: > Hello Guys, > > Does any have a regex for email validation? I need to allow only period and > underscore in the local part , we would need a @ and .com or watever for > domain. php should have a good check built-in. see http://www.php.net/manual/e

Re: [PHP] Regex in PHP

2008-06-05 Thread Richard Heyes
> sorry to bother you richard. You didn't, I just wanted to make sure I wasn't losing it (more). -- Richard Heyes ++ | Access SSH with a Windows mapped drive | |http://www.phpguru.org/sftpdrive| ++ -- PHP G

Re: [PHP] Regex in PHP

2008-06-04 Thread Robert Cummings
On Thu, 2008-06-05 at 00:24 -0400, Nathan Nobbe wrote: > > you really know how to rub it in there rob. but i was looking at the > implementation in the php code, looks like somebody likes my idea > (this code > found in ext/standard/string.c). on the second line the haystack is > converted to low

Re: [PHP] Regex in PHP

2008-06-04 Thread Nathan Nobbe
On Wed, Jun 4, 2008 at 11:43 PM, Robert Cummings <[EMAIL PROTECTED]> wrote: > On Wed, 2008-06-04 at 23:20 -0400, Nathan Nobbe wrote: > > > > i repeated your test using the time program and splitting the script into > 2, > > one for each strpos and stripos, to find similar results. imo, there is >

Re: [PHP] Regex in PHP

2008-06-04 Thread Robert Cummings
On Wed, 2008-06-04 at 23:20 -0400, Nathan Nobbe wrote: > > i repeated your test using the time program and splitting the script into 2, > one for each strpos and stripos, to find similar results. imo, there is no > need for 2 comparisons for case-insensitive searches, because both arguments > can

Re: [PHP] Regex in PHP

2008-06-04 Thread Nathan Nobbe
On Wed, Jun 4, 2008 at 2:06 PM, Robert Cummings <[EMAIL PROTECTED]> wrote: > On Wed, 2008-06-04 at 11:18 -0600, Nathan Nobbe wrote: > > On Wed, Jun 4, 2008 at 11:12 AM, Robert Cummings <[EMAIL PROTECTED]> > > wrote: > > > > > Did you just try to use a test that used a single iteration to prove me

Re: [PHP] Regex in PHP

2008-06-04 Thread Robert Cummings
On Wed, 2008-06-04 at 11:18 -0600, Nathan Nobbe wrote: > On Wed, Jun 4, 2008 at 11:12 AM, Robert Cummings <[EMAIL PROTECTED]> > wrote: > > > Did you just try to use a test that used a single iteration to prove me > > wrong? OMFG ponies!!! Loop each one of those 10 million times, use a > > separate

Re: [PHP] Regex in PHP

2008-06-04 Thread Robert Cummings
On Wed, 2008-06-04 at 13:12 -0400, Robert Cummings wrote: > On Wed, 2008-06-04 at 10:56 -0600, Nathan Nobbe wrote: > > On Wed, Jun 4, 2008 at 10:26 AM, Robert Cummings <[EMAIL PROTECTED]> > > wrote: > > > > > Nope, case insensitive is slower since you must make two tests for > > > characters havin

Re: [PHP] Regex in PHP

2008-06-04 Thread Nathan Nobbe
On Wed, Jun 4, 2008 at 11:12 AM, Robert Cummings <[EMAIL PROTECTED]> wrote: > Did you just try to use a test that used a single iteration to prove me > wrong? OMFG ponies!!! Loop each one of those 10 million times, use a > separate script for each, and use the system time program to > appropriatel

Re: [PHP] Regex in PHP

2008-06-04 Thread Nitsan Bin-Nun
at least he have some humer ;-) On 04/06/2008, Robert Cummings <[EMAIL PROTECTED]> wrote: > > On Wed, 2008-06-04 at 10:56 -0600, Nathan Nobbe wrote: > > On Wed, Jun 4, 2008 at 10:26 AM, Robert Cummings <[EMAIL PROTECTED]> > > wrote: > > > > > Nope, case insensitive is slower since you must make tw

Re: [PHP] Regex in PHP

2008-06-04 Thread Robert Cummings
On Wed, 2008-06-04 at 10:56 -0600, Nathan Nobbe wrote: > On Wed, Jun 4, 2008 at 10:26 AM, Robert Cummings <[EMAIL PROTECTED]> > wrote: > > > Nope, case insensitive is slower since you must make two tests for > > characters having a lower and upper case version. With case sensitive > > comparisons

Re: [PHP] Regex in PHP

2008-06-04 Thread Nitsan Bin-Nun
I can't find any good reason for regex in this case. you can try to split it with explode / stristr / create a function by your own which goes over the string and check when a @ is catched, something like: function GetDomainName ($a) { $returnDomain = ""; $beigale = false; for ($i = 0; $i < strl

Re: [PHP] Regex in PHP

2008-06-04 Thread Nathan Nobbe
On Wed, Jun 4, 2008 at 10:26 AM, Robert Cummings <[EMAIL PROTECTED]> wrote: > Nope, case insensitive is slower since you must make two tests for > characters having a lower and upper case version. With case sensitive > comparisons you only need to make a single comparison. a quick test shows str

Re: [PHP] Regex in PHP

2008-06-04 Thread Robert Cummings
On Wed, 2008-06-04 at 10:18 -0600, Nathan Nobbe wrote: > On Wed, Jun 4, 2008 at 10:10 AM, Richard Heyes <[EMAIL PROTECTED]> wrote: > > > Hi, > > > > and the case insensitive versions are a hair faster still ;) > >> > > > > Are they? I always thought that case-sensitive functions were faster > > b

Re: [PHP] Regex in PHP

2008-06-04 Thread Nathan Nobbe
On Wed, Jun 4, 2008 at 10:10 AM, Richard Heyes <[EMAIL PROTECTED]> wrote: > Hi, > > and the case insensitive versions are a hair faster still ;) >> > > Are they? I always thought that case-sensitive functions were faster > because they have to test fewer comparisons. Eg To test if i == I in a > c

Re: [PHP] Regex in PHP

2008-06-04 Thread Richard Heyes
Hi, and the case insensitive versions are a hair faster still ;) Are they? I always thought that case-sensitive functions were faster because they have to test fewer comparisons. Eg To test if i == I in a case-insensitive fashion requires two comparisons (i == I and i == i) whereas a case-s

Re: [PHP] Regex in PHP

2008-06-03 Thread Nathan Nobbe
On Tue, Jun 3, 2008 at 8:39 PM, VamVan <[EMAIL PROTECTED]> wrote: > Hello All, > > For example I have these email addressess - > > [EMAIL PROTECTED] > [EMAIL PROTECTED] > [EMAIL PROTECTED] > > What would be my PHP function[Regular expression[ to that can give me some > thing like > > yahoo.com > h

Re: [PHP] Regex in PHP

2008-06-03 Thread Liran Oz
You can use this: $str = '[EMAIL PROTECTED]'; preg_match('/[EMAIL PROTECTED]@(.+)/', $str, $matches); var_dump($matches);//will be in $matches[1] Or without regex: echo substr($str, strpos($str, '@')+1); Liran - Original Message - From: "VamVan" <[EMAIL PROTECTED]> To: Sent: We

Re: [PHP] Regex to catch s

2008-05-07 Thread Aschwin Wesselius
Ryan S wrote: Hey! Thansk for replying! It is obvious I haven't had my caffeine yet. This is my last try to get the pattern straight: hello hello those hello hello this rose hello nose hello that hello END_OF_HTML; $tags = array(); $tags[] = 'p'; $tags[] = 'a'; $attr = array(); $attr[] =

Re: [PHP] Regex to catch s (weird result)

2008-05-07 Thread Jon L.
Pretty close. The only thing I'd suggest is a different way of wording step 2: Can contain anything but '>' until step 3. As for the switches/modifiers (Uis), check out: http://us.php.net/manual/en/reference.pcre.pattern.modifiers.php U = ungreedy i = case-insensitive (|p| matches 'p' and/or 'P'

Re: [PHP] Regex to catch s (weird result)

2008-05-07 Thread Ryan S
> http://www.ezee.se/tests/para_regex2.php.txt Yep, sorry... Just add the s preg_match_all('|]*>(.*)|Uis', $myText, $myArray); Swett! It works! If you _do get time_, would love to know the actual meaning of |]*>(.*)|Uis because although I do appreciate the help and the code, am learni

Re: [PHP] Regex to catch s (weird result)

2008-05-07 Thread Shawn McKenzie
Ryan S wrote: preg_match_all('|]*>(.*)|Ui', $myText, $myArray); Hey! Thanks for replying. Your preg_match_all works like a charm, but for some reason catches only 8 out of 9 paragraphs... its really weird. I have upped the test page to http://www.ezee.se/tests/para_regex2.php.txt so you

Re: [PHP] Regex to catch s (weird result)

2008-05-07 Thread Ryan S
preg_match_all('|]*>(.*)|Ui', $myText, $myArray); Hey! Thanks for replying. Your preg_match_all works like a charm, but for some reason catches only 8 out of 9 paragraphs... its really weird. I have upped the test page to http://www.ezee.se/tests/para_regex2.php.txt so you can have a look

Re: [PHP] Regex to catch s

2008-05-06 Thread Shawn McKenzie
Ryan S wrote: To say I suck at regex is an understatement so really need any help I can get on this, I have a page of text with different html tags in them, but each "block" of text has a or a < class="something"> tag... anybody have any regex that will catch each of these paragraphs and p

Re: [PHP] Regex to catch s

2008-05-06 Thread Aschwin Wesselius
Aschwin Wesselius wrote: Aschwin Wesselius wrote: Ryan S wrote: Hey all! To say I suck at regex is an understatement so really need any help I can get on this, I have a page of text with different html tags in them, but each "block" of text has a or a < class="something"> tag... anybody h

Re: [PHP] Regex to catch s

2008-05-06 Thread Aschwin Wesselius
Aschwin Wesselius wrote: Ryan S wrote: Hey all! To say I suck at regex is an understatement so really need any help I can get on this, I have a page of text with different html tags in them, but each "block" of text has a or a < class="something"> tag... anybody have any regex that will ca

Re: [PHP] Regex to catch s

2008-05-06 Thread Aschwin Wesselius
Ryan S wrote: Hey all! To say I suck at regex is an understatement so really need any help I can get on this, I have a page of text with different html tags in them, but each "block" of text has a or a < class="something"> tag... anybody have any regex that will catch each of these paragraph

Re: [PHP] Regex to catch s

2008-05-05 Thread Ryan S
> To say I suck at regex is an understatement so really need any help I can > get on this, I have a page of text with different html tags in them, but each > "block" of text has a or a < class="something"> tag... anybody have any > regex that will catch each of these paragraphs and put then

Re: [PHP] Regex to catch s

2008-05-05 Thread Eric Butera
On Mon, May 5, 2008 at 9:59 PM, Ryan S <[EMAIL PROTECTED]> wrote: > To say I suck at regex is an understatement so really need any help I can > get on this, I have a page of text with different html tags in them, but each > "block" of text has a or a < class="something"> tag... anybody have any

Re: [PHP] regex usage

2008-02-18 Thread Richard Lynch
On Sun, February 17, 2008 9:34 am, Valedol wrote: > Is there a mothod to check string`s length with regex or the only way > is > using strlen? > > I want string consisting of 4 digits > and check string with this code: > > if (preg_match("/\d{4}/",$_POST[id])) > { echo $_POST[id]; } > > but preg_

Re: [PHP] regex usage

2008-02-17 Thread Jim Lucas
Valedol wrote: Is there a mothod to check string`s length with regex or the only way is using strlen? I want string consisting of 4 digits and check string with this code: if (preg_match("/\d{4}/",$_POST[id])) { echo $_POST[id]; } but preg_match returns true when string consists of 4 or more

Re: [PHP] regex usage

2008-02-17 Thread Nirmalya Lahiri
--- Valedol <[EMAIL PROTECTED]> wrote: > Is there a mothod to check string`s length with regex or the only > way is > using strlen? > > I want string consisting of 4 digits > and check string with this code: > > if (preg_match("/\d{4}/",$_POST[id])) > { echo $_POST[id]; } > > but preg_match

Re: [PHP] regex usage

2008-02-17 Thread Richard Heyes
Is there a mothod to check string`s length with regex or the only way is using strlen? I want string consisting of 4 digits and check string with this code: if (preg_match("/\d{4}/",$_POST[id])) { echo $_POST[id]; } but preg_match returns true when string consists of 4 or more digits You co

Re: [PHP] regex usage

2008-02-17 Thread Shawn McKenzie
Valedol wrote: > Is there a mothod to check string`s length with regex or the only way is > using strlen? > > I want string consisting of 4 digits > and check string with this code: > > if (preg_match("/\d{4}/",$_POST[id])) > { echo $_POST[id]; } > > but preg_match returns true when string cons

Re: [PHP] regex

2008-01-22 Thread Richard Lynch
t; $tbl_name1 = preg_replace('/\s/', '_', $tbl_name1); > $col_name2 = preg_replace('/\s/', '_', $col_name2); > > > $sql = << $sql_query > $tbl_name.$col_name, > $tbl_name1.$col_name2 > OUT; > > echo "Contents of \$sql: $

Re: [PHP] regex

2008-01-22 Thread Richard Lynch
You'd need to use a "look-ahead" or "look-behind" with PCRE to do this. Search for a thread just last week involving quotes and HTML attributes for an example. PS You could probably get the DB to ignore case in table names and table fields with some kind of "set". You also could probably just re

Re: [PHP] regex

2008-01-21 Thread Peter Jackson
Jim Lucas wrote: Peter wrote: I am trying to convert ms access sql to postgresql using php. I have a sql statement in the form ;- $sql = SELECT DISTINCT [Table Name].[Column.Name], [Table Name 1].[Column Name 2] etc. what I want to end up with is $sql = SELECT DISTINCT table_name.column_nam

Re: [PHP] regex

2008-01-21 Thread Peter Jackson
Jim Lucas wrote: Peter wrote: I am trying to convert ms access sql to postgresql using php. I have a sql statement in the form ;- $sql = SELECT DISTINCT [Table Name].[Column.Name], [Table Name 1].[Column Name 2] etc. what I want to end up with is $sql = SELECT DISTINCT table_name.column_nam

Re: [PHP] regex

2008-01-21 Thread Jim Lucas
Peter wrote: I am trying to convert ms access sql to postgresql using php. I have a sql statement in the form ;- $sql = SELECT DISTINCT [Table Name].[Column.Name], [Table Name 1].[Column Name 2] etc. what I want to end up with is $sql = SELECT DISTINCT table_name.column_name, table_name_1.co

Re: [PHP] regex

2008-01-21 Thread Keith Roberts
he above code is not optimal, but it works OK. I use the heredoc construct to build my sql query strings. Saves using all those single and double quote characters. http://uk2.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc HTH Keith Roberts -

Re: [PHP] regex

2008-01-21 Thread Peter
Well actually not a real lot so far. I'm just trial and error(lots of that) at the moment. I've only been 'playing with php for about a month or so. $file = "phptest1.txt"; $rep = array ("tbl_" , "_%", "bool default 0", "bool default 1", '?'); $wih = array ("", "_pc", "bool DEFAULT FALSE", "bool D

Re: [PHP] regex

2008-01-21 Thread Keith Roberts
Can yo upost the code you have got to do the conversion so far please? Regards Keith - Websites: http://www.karsites.net http://www.php-debuggers.net http://www.raised-from-the-dead.org.uk All email addresses are challenge-respon

Re: [PHP] REGEX: grouping of alternative patterns [SOLVED]

2007-10-30 Thread Stijn Verholen
Robin Vickery schreef: [snip] Because each of your subpatterns can match an empty string, the lefthand subpattern always matches and the righthand subpattern might as well not be there. Indeed they do, i did not realise that. The simplest solution, if you don't want to completely rethink yo

RE: [PHP] REGEX: grouping of alternative patterns

2007-10-30 Thread Ford, Mike
On 30 October 2007 11:07, Stijn Verholen wrote: > Hey list, > > I'm having problems with grouped alternative patterns. > The regex I would like to use, is the following: > > /\s*(`?.+`?)\s*int\s*(\(([0-9]+)\))?\s*(unsigned)?\s*(((auto_i > ncrement)?\s*(primary\s*key)?)|((not\s*null)?\s*(default\

Re: [PHP] REGEX: grouping of alternative patterns

2007-10-30 Thread Robin Vickery
On 30/10/2007, Stijn Verholen <[EMAIL PROTECTED]> wrote: > Hey list, > > I'm having problems with grouped alternative patterns. > The regex I would like to use, is the following: > > /\s*(`?.+`?)\s*int\s*(\(([0-9]+)\))?\s*(unsigned)?\s*(((auto_increment)?\s*(primary\s*key)?)|((not\s*null)?\s*(defau

Re: [PHP] Regex for Advanced search feature

2007-10-19 Thread Robert Cummings
On Fri, 2007-10-19 at 09:48 -0700, Kevin Murphy wrote: > I'm trying to create an advanced search feature for my site, and I > have it mostly working the way I want. I take whatever search term > ($searchkey) that the user submits, explodes if off any spaces > between words, and then use that

Re: [PHP] Regex æøå email validation?

2007-09-25 Thread Per Jessen
Søren Neigaard wrote: > It works fine, but my friend strangely enough has users with special > danish letters (æøåÆØÅ) in their email address, and that it does not > accept. Hej Søren I just realised - you can't have those characters in the email address. You may have them in the name part, bu

Re: [PHP] Regex æøå email validation?

2007-09-24 Thread mike
On 9/24/07, Per Jessen <[EMAIL PROTECTED]> wrote: > > Hi guys > > > > Im helping a friend with hes internet site, and I have found this > > regex email validation regex on the internet: > > > > var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a- > > z]{2,6}(?:\.[a-z]{2})?)$/i; > >

Re: [PHP] Regex æøå email validation?

2007-09-24 Thread Per Jessen
Søren Neigaard wrote: > Hi guys > > Im helping a friend with hes internet site, and I have found this > regex email validation regex on the internet: > > var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a- > z]{2,6}(?:\.[a-z]{2})?)$/i; > if(!filter.test(email)) { > return false

Re: [PHP] Regex error

2007-03-14 Thread Richard Lynch
On Wed, March 14, 2007 7:56 pm, jekillen wrote: > Hello; > The following regex: > > ereg(" id='$m[1]'>", $groups, $m1); > > is causing the following error: > > Warning: ereg() [function.ereg]: REG_ERANGE in _proc.php on > line 81 > > Can someone tell me what this means? You used to have the -

Re: [PHP] Regex error

2007-03-14 Thread Myron Turner
jekillen wrote: Hello; The following regex: ereg("id='$m[1]'>", $groups, $m1); is causing the following error: Warning: ereg() [function.ereg]: REG_ERANGE in _proc.php on line 81 Can someone tell me what this means? What I am trying to do is pick out some info from an xml tag the is id'd

Re: [PHP] Regex Mixtake

2007-02-04 Thread Richard Lynch
On Sat, February 3, 2007 12:58 pm, Manolet Gmail wrote: > anyway, PCRE is better that ereg? Yes! Faster, easier, more flexible, and better documented. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch

Re: [PHP] Regex Mixtake

2007-02-03 Thread Robert Cummings
On Sat, 2007-02-03 at 13:58 -0500, Manolet Gmail wrote: > 2007/2/3, Steffen Ebermann <[EMAIL PROTECTED]>: > > You have to use preg_match_all() > > > > if (preg_match_all("!\"(.+)\"!sU", $var, $match)) > > > > > > oh wow! works very well... but... i take 2 days reading about ereg ='( > there is

Re: [PHP] Regex Mixtake

2007-02-03 Thread Steffen Ebermann
Side note: $exp = explode('"', $var); foreach ($exp as $key => $val) if ($key%2!=0) $arr[] = $val; var_dump($arr); works without regular expressions. -- Steffen On Sat, Feb 03, 2007 at 12:36:59PM -0500, Manolet Gmail wrote: > Hi, i have a problem using regex, i want to get all the text b

Re: [PHP] Regex Mixtake

2007-02-03 Thread Manolet Gmail
well thanks you too much, i will learn the preg sintax. 2007/2/3, Steffen Ebermann <[EMAIL PROTECTED]>: I don't know, but http://php.net/manual/en/function.ereg.php says "Note: preg_match(), which uses a Perl-compatible regular expression syntax, is often a faster alternative to ereg

Re: [PHP] Regex Mixtake

2007-02-03 Thread Steffen Ebermann
I don't know, but http://php.net/manual/en/function.ereg.php says "Note: preg_match(), which uses a Perl-compatible regular expression syntax, is often a faster alternative to ereg()." On Sat, Feb 03, 2007 at 01:58:50PM -0500, Manolet Gmail wrote: > anyway, PCRE is better that ereg?

Re: [PHP] Regex Mixtake

2007-02-03 Thread Manolet Gmail
2007/2/3, Steffen Ebermann <[EMAIL PROTECTED]>: You have to use preg_match_all() if (preg_match_all("!\"(.+)\"!sU", $var, $match)) oh wow! works very well... but... i take 2 days reading about ereg ='( there is no way to do this using ereg an not preg (PCRE)... anyway, PCRE is better that

Re: [PHP] Regex Mixtake

2007-02-03 Thread Steffen Ebermann
You have to use preg_match_all() if (preg_match_all("!\"(.+)\"!sU", $var, $match)) On Sat, Feb 03, 2007 at 12:36:59PM -0500, Manolet Gmail wrote: > Hi, i have a problem using regex, i want to get all the text between " " > > so i try this... > > $subject = 'menu "Archer?",-,"Chief?",L_Menu2,

Re: [PHP] regex

2006-10-23 Thread Richard Lynch
On Thu, October 19, 2006 9:42 am, Robin Vickery wrote: > On 19/10/06, Bagus Nugroho <[EMAIL PROTECTED]> wrote: >> Hi All, >> >> If we have variable like : >> >> $var1 = 'abcde 12'; >> $var2 = 'abcdefghi 34'; >> $var3 = 'abc 20 def'; >> >> Then we want output like : >> $var1 = 'abcde'; >> $var2

Re: [PHP] regex

2006-10-19 Thread Robin Vickery
On 19/10/06, Bagus Nugroho <[EMAIL PROTECTED]> wrote: Hi All, If we have variable like : $var1 = 'abcde 12'; $var2 = 'abcdefghi 34'; $var3 = 'abc 20 def'; Then we want output like : $var1 = 'abcde'; $var2 = 'abcdefghi'; $var3 = 'abc def'; $re = '/^\s+|\d+\s*|\s*\d+\s*$/'; $var1 = preg_repl

Re: [PHP] regex

2006-10-19 Thread Stut
Bagus Nugroho wrote: If we have variable like : $var1 = 'abcde 12'; $var2 = 'abcdefghi 34'; $var3 = 'abc 20 def'; Then we want output like : $var1 = 'abcde'; $var2 = 'abcdefghi'; $var3 = 'abc def'; How regex can help us?. It's very difficult to get the right solution to a problem when all yo

Re: [PHP] regex

2006-10-19 Thread Google Kreme
On 19 Oct 2006, at 07:56 , John Nichel wrote: $var3 = 'abc 20 def'; Then we want output like : $var3 = 'abc def'; How regex can help us?. Use preg_replace to replace all numbers with nothing. $var = preg_replace ( "/\d+/", "", $var ); Nope, that will leave $var3 = 'abc def'; (note the dou

Re: [PHP] regex

2006-10-19 Thread Google Kreme
On 19 Oct 2006, at 07:49 , Bagus Nugroho wrote: Hi All, If we have variable like : $var1 = 'abcde 12'; $var2 = 'abcdefghi 34'; $var3 = 'abc 20 def'; Then we want output like : $var1 = 'abcde'; $var2 = 'abcdefghi'; $var3 = 'abc def'; How regex can help us?. Well, stripping the digits is eas

Re: [PHP] regex

2006-10-19 Thread John Nichel
Bagus Nugroho wrote: Hi All, If we have variable like : $var1 = 'abcde 12'; $var2 = 'abcdefghi 34'; $var3 = 'abc 20 def'; Then we want output like : $var1 = 'abcde'; $var2 = 'abcdefghi'; $var3 = 'abc def'; How regex can help us?. Use preg_replace to replace all numbers with nothing. $var

Re: [PHP] Regex

2006-08-21 Thread Richard Lynch
On Mon, August 21, 2006 4:51 am, Nadim Attari wrote: > I have some text in a table... the text contains hyperlinks (but not > html coded, i.e. plain "Some text...http://www.something.com";) > > When i retrieve these texts from the table, i want the hyperlinks to > become clickable, i.e. > "Some te

RE: [PHP] regex brain-toot

2006-06-19 Thread Jay Blanchard
[snip] Do you have to use ereg? The preg_match pattern I posted works fine. It will return an array, first element being the whole string it matched, next element will be what it matched _inside_ the parentheses (less the parentheses) (if it matches anything that is). [/snip] Thanks Johnth

Re: [PHP] regex brain-toot

2006-06-19 Thread John Nichel
Jay Blanchard wrote: [snip] Anot PCRE. Can't help you there, as I've never used the ereg functions. However... preg_match ( "/\((\d{1,}.*?)\)/", "Upper Voltage (124.1)", $regs ); [/snip] Still returns parentheses ereg("[^\(][0-9\.]*" , "Upper Voltage (124.1)", $regs ); gets rid of

RE: [PHP] regex brain-toot

2006-06-19 Thread Jay Blanchard
[snip] Anot PCRE. Can't help you there, as I've never used the ereg functions. However... preg_match ( "/\((\d{1,}.*?)\)/", "Upper Voltage (124.1)", $regs ); [/snip] Still returns parentheses ereg("[^\(][0-9\.]*" , "Upper Voltage (124.1)", $regs ); gets rid of opening bracket, but e

Re: [PHP] regex brain-toot

2006-06-19 Thread John Nichel
Jay Blanchard wrote: [snip] \(([0-9]*)\) [/snip] I had done this before and still get the parenthesis... ereg("\(([0-9]*)\)", "Upper Voltage (124.1)", $regs); Anot PCRE. Can't help you there, as I've never used the ereg functions. However... preg_match ( "/\((\d{1,}.*?)\)/", "U

RE: [PHP] regex brain-toot

2006-06-19 Thread Jay Blanchard
[snip] You won't match the dot btw: \(([.0-9]*)\) Which is crude since it will match more than one dot :) [/snip] Typo on my part \(([0-9\.]*)\)...but still gets parenthesis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] regex brain-toot

2006-06-19 Thread Jay Blanchard
[snip] \(([0-9]*)\) [/snip] I had done this before and still get the parenthesis... ereg("\(([0-9]*)\)", "Upper Voltage (124.1)", $regs); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] regex brain-toot

2006-06-19 Thread Robert Cummings
On Mon, 2006-06-19 at 14:42, John Nichel wrote: > Jay Blanchard wrote: > > I have a field that contains a value in parenthesis', but also contains > > other text, for instance; (it is a legacy app that I am working with, > > and by legacy I am saying pre-1980) > > > > Upper voltage (124.1) > > >

<    1   2   3   4   5   6   >