Re: [PHP] Regex

2012-07-27 Thread Simon Dániel
#[0-9a-zA-Z,.]# 2012/7/27 Ethan Rosenberg eth...@earthlink.net Dear list - I've tried everything and am still stuck. A regex that will accept numbers, letters, comma, period and no other characters Thanks. Ethan Rosenberg -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] Regex

2012-07-27 Thread Stuart Dallas
On 27 Jul 2012, at 18:07, Ethan Rosenberg eth...@earthlink.net wrote: I've tried everything and am still stuck. A regex that will accept numbers, letters, comma, period and no other characters /^[0-9a-zA-Z,\.]+$/ -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- PHP General

Re: [PHP] Regex

2012-07-27 Thread Sebastian Krebs
Hi, Am 27.07.2012 19:07, schrieb Ethan Rosenberg: Dear list - I've tried everything and am still stuck. A regex that will accept numbers, letters, comma, period and no other characters This? /^[0-9a-zA-Z,.]$/ Regards, Sebastian Thanks. Ethan Rosenberg -- PHP General Mailing

Re: [PHP] Regex

2012-07-27 Thread Ashley Sheridan
Simon Dániel simondan...@gmail.com wrote: #[0-9a-zA-Z,\.]# You should escape out that period as it will match any character otherwise. Thanks, Ash http://ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Regex

2012-07-27 Thread David Harkness
On Fri, Jul 27, 2012 at 10:16 AM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: Simon Dániel simondan...@gmail.com wrote: #[0-9a-zA-Z,\.]# You should escape out that period as it will match any character otherwise The dot only matches a period inside a character class [...]. David

Re: [PHP] Regex

2012-07-27 Thread shiplu
#[0-9a-zA-Z,\.]# You should escape out that period as it will match any character otherwise. Thanks, Ash Ash, Thats not true. In character class only meta-characters are \ ^ - [ and ]. This is the rule of PCRE (see

Re: [PHP] Regex

2012-07-27 Thread Sebastian Krebs
Am 27.07.2012 19:54, schrieb shiplu: #[0-9a-zA-Z,\.]# You should escape out that period as it will match any character otherwise. Thanks, Ash Ash, Thats not true. In character class only meta-characters are \ ^ - [ And the dash only when it's not the first, or the last in the class.

RE: [PHP] regex or 'tidy' script to fix broken ? tags and introspection of variables

2011-08-10 Thread Daevid Vincent
-Original Message- From: Camilo Sperberg [mailto:unrea...@gmail.com] Sent: Tuesday, August 09, 2011 5:27 PM For the first one, it may be that zend studio does have an internal script to do the job. Check the general preferences tab, template stuff. Nope. Nothing there. Those

Re: [PHP] regex or 'tidy' script to fix broken ? tags and introspection of variables

2011-08-10 Thread Camilo Sperberg
On 10-08-2011, at 16:54, Daevid Vincent wrote: -Original Message- From: Camilo Sperberg [mailto:unrea...@gmail.com] Sent: Tuesday, August 09, 2011 5:27 PM For the first one, it may be that zend studio does have an internal script to do the job. Check the general preferences tab,

Re: [PHP] regex or 'tidy' script to fix broken ? tags and introspection of variables

2011-08-09 Thread Camilo Sperberg
For the first one, it may be that zend studio does have an internal script to do the job. Check the general preferences tab, template stuff. Please note that ?= is also valid and should be replaced to ?php echo instead. Also the short if version 1 == 1 ? True : false should be replaced if i'm

Re: [PHP] Regex pattern for preg_match_all

2011-02-22 Thread Yann Milin
Le 19/02/2011 0:23, Tommy Pham a écrit : @Simon, Thanks for explaining about the [^href]. I need to read up more about greediness. I thought I understood it but guess not. @Peter, I tried your pattern but it didn't capture all of my new test cases. Also, it captures the single/double quotes

Re: [PHP] Regex pattern for preg_match_all

2011-02-18 Thread Simon J Welsh
As far as I can tell, your problem lies in [^href]*. That will match any characters other than h, r, e or f, not anything other than the string href. Consider replacing it with [^]*?. The ? makes it non-greedy so it will stop as soon as it can (when it matches the first href) rather than as

Re: [PHP] Regex pattern for preg_match_all

2011-02-18 Thread Peter Lind
On 18 February 2011 22:36, Tommy Pham tommy...@gmail.com wrote: Hi folks, This is not directly relating to PHP but it's Friday so I'm gonna give it a shot :).  Would someone please help me figure out why my regex pattern doesn't work.  Below is the code and sample data: $html = HTML li

Re: [PHP] Regex pattern for preg_match_all

2011-02-18 Thread Tommy Pham
@Simon, Thanks for explaining about the [^href]. I need to read up more about greediness. I thought I understood it but guess not. @Peter, I tried your pattern but it didn't capture all of my new test cases. Also, it captures the single/double quotes in addition to the fragments inside the

Re: [PHP] Regex for ... genealogical names

2011-01-01 Thread Ashley Sheridan
On Sat, 2011-01-01 at 09:46 +, Lester Caine wrote: A slightly more complex problem than phone numbers ... It is a sort of convention to use the format 'JohnDoeSMITH' or 'John Doe SMITH' where each forename starts with a capital and the surname is in upper case. I have a crude method

Re: [PHP] Regex for telephone numbers

2010-12-31 Thread Nathan Rixham
Ethan Rosenberg wrote: FYI [to all the list] -- I thank all for their input. I only needed US phones, and I am forcing the user of the form to conform to xxx-xxx- as the input format. out of interest, why are you forcing you're users to conform to that input format? you could simply

Re: [PHP] Regex for telephone numbers

2010-12-31 Thread Ethan Rosenberg
At 07:11 AM 12/31/2010, Nathan Rixham wrote: Ethan Rosenberg wrote: FYI [to all the list] -- I thank all for their input. I only needed US phones, and I am forcing the user of the form to conform to xxx-xxx- as the input format. out of interest, why are you forcing you're users to

Re: [PHP] Regex for telephone numbers

2010-12-31 Thread a...@ashleysheridan.co.uk
Sorry for top-post, on phone. What about mobile phone numbers (cell phones you call them in the US) do they conform to the same format? I know there have been times myself when I've been without a landline number leaving me with only my mobile as a means of contact. Thanks, Ash

Re: [PHP] Regex for telephone numbers

2010-12-31 Thread Ethan Rosenberg
At 09:27 AM 12/31/2010, a...@ashleysheridan.co.uk wrote: Sorry for top-post, on phone. What about mobile phone numbers (cell phones you call them in the US) do they conform to the same format? I know there have been times myself when I've been without a landline number leaving me with only

Re: [PHP] Regex for telephone numbers

2010-12-31 Thread Nathan Rixham
Ethan Rosenberg wrote: At 07:11 AM 12/31/2010, Nathan Rixham wrote: Ethan Rosenberg wrote: FYI [to all the list] -- I thank all for their input. I only needed US phones, and I am forcing the user of the form to conform to xxx-xxx- as the input format. out of interest, why are you

Re: [PHP] Regex for telephone numbers

2010-12-31 Thread Per Jessen
a...@ashleysheridan.co.uk wrote: Sorry for top-post, on phone. What about mobile phone numbers (cell phones you call them in the US) do they conform to the same format? AFAIK, they too vary from country to country. Swiss mobile numbers are 07[6789] NNN, the latter usually written as

Re: [PHP] Regex for telephone numbers

2010-12-31 Thread Daniel P. Brown
On Fri, Dec 31, 2010 at 11:04, Per Jessen p...@computer.org wrote: AFAIK, they too vary from country to country.  Swiss mobile numbers are 07[6789] NNN, the latter usually written as NNN NN NN, but also often in a way that will help remembering the number. Danish mobile#s are the same as

Re: [PHP] Regex for telephone numbers

2010-12-31 Thread Dmitriy Ugnichenko
I guess, this will work fine ereg('[0-9]{3}-[0-9]{3}-[0-9]{4}', $phone_number); On Thu, Dec 30, 2010 at 2:12 AM, Ethan Rosenberg eth...@earthlink.netwrote: Dear List - Thank you for all your help in the past. Here is another one I would like to have a regex which would validate

Re: [PHP] Regex for telephone numbers

2010-12-31 Thread Daniel Brown
On Fri, Dec 31, 2010 at 12:05, Dmitriy Ugnichenko mitya.ugniche...@gmail.com wrote: I guess, this will work fine ereg('[0-9]{3}-[0-9]{3}-[0-9]{4}',  $phone_number); Not quite. Plus, all ereg* functions have been deprecated for some time now. -- /Daniel P. Brown Network Infrastructure

Re: [PHP] Regex for telephone numbers

2010-12-31 Thread Steve Staples
On Wed, 2010-12-29 at 19:35 -0500, Daniel P. Brown wrote: On Wed, Dec 29, 2010 at 19:12, Ethan Rosenberg eth...@earthlink.net wrote: Dear List - Thank you for all your help in the past. Here is another one I would like to have a regex which would validate that a telephone

Re: [PHP] Regex for telephone numbers

2010-12-31 Thread Jim Lucas
On 12/29/2010 4:35 PM, Daniel P. Brown wrote: On Wed, Dec 29, 2010 at 19:12, Ethan Rosenberg eth...@earthlink.net wrote: Dear List - Thank you for all your help in the past. Here is another one I would like to have a regex which would validate that a telephone number is in the format

Re: [PHP] Regex for telephone numbers

2010-12-31 Thread Daniel P. Brown
On Fri, Dec 31, 2010 at 19:09, Jim Lucas li...@cmsws.com wrote: Actually... Specified here [1] it says that the {1,} is the same as '+'.  I think you should drop the comma.  If you don't this would be valid 844-2345-123456 ^[2-9]{1,}[0-9]{2,}\-[2-9]{1,}[0-9]{2,}\-[0-9]{4,}$ should be

Re: [PHP] Regex for telephone numbers

2010-12-30 Thread Ethan Rosenberg
At 07:27 PM 12/29/2010, Josh Kehn wrote: On Dec 29, 2010, at 7:12 PM, Ethan Rosenberg eth...@earthlink.net wrote: Dear List - Thank you for all your help in the past. Here is another one I would like to have a regex which would validate that a telephone number is in the format

[PHP] Re: [PHP-DB] Re: [PHP] Regex for telephone numbers

2010-12-30 Thread Daniel Brown
On Thu, Dec 30, 2010 at 14:07, Ethan Rosenberg eth...@earthlink.net wrote: Josh - I used use \d{3}-\d{3}-\d{4}. It works beautifully!! Just keep in mind that invalid numbers will also pass that check, such as 000-000- or 123-456-6789. That's why my example was a bit more involved.

Re: [PHP] Regex for telephone numbers

2010-12-30 Thread Tamara Temple
On Dec 29, 2010, at 6:12 PM, Ethan Rosenberg wrote: I would like to have a regex which would validate that a telephone number is in the format xxx-xxx-. http://lmgtfy.com/?q=regex+to+validate+US+phone+numbers -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

RE: [PHP] Regex for telephone numbers

2010-12-29 Thread admin
I suggest you try javascript. Richard L. Buskirk -Original Message- From: Ethan Rosenberg [mailto:eth...@earthlink.net] Sent: Wednesday, December 29, 2010 7:12 PM To: php-db-lists.php.net; php-general@lists.php.net Subject: [PHP] Regex for telephone numbers Dear List - Thank you for

Re: [PHP] Regex for telephone numbers

2010-12-29 Thread Simon J Welsh
On 30/12/2010, at 1:12 PM, Ethan Rosenberg wrote: Dear List - Thank you for all your help in the past. Here is another one I would like to have a regex which would validate that a telephone number is in the format xxx-xxx-. Thanks. Ethan MySQL 5.1 PHP 5 Linux

RE: [PHP] Regex for telephone numbers

2010-12-29 Thread admin
Also remove your stupid Email filter. If you need a email filter, you should not be on this list or learn to setup rules one. Richard L. Buskirk -Original Message- From: Ethan Rosenberg [mailto:eth...@earthlink.net] Sent: Wednesday, December 29, 2010 7:12 PM To: php-db-lists.php.net;

Re: [PHP] Regex for telephone numbers

2010-12-29 Thread Josh Kehn
On Dec 29, 2010, at 7:12 PM, Ethan Rosenberg eth...@earthlink.net wrote: Dear List - Thank you for all your help in the past. Here is another one I would like to have a regex which would validate that a telephone number is in the format xxx-xxx-. Thanks. Ethan

[PHP] Re: [PHP-DB] Re: [PHP] Regex for telephone numbers

2010-12-29 Thread Karl DeSaulniers
Hi Ethan, Could you do a string compare and check at certain characters for a dash? IE: check the second character to see if it is a dash for 1-800... if that is not a dash, check the fourth character for a dash, 469-9... then the other places where dashes would be based on those two

[PHP] Re: [PHP-DB] Re: [PHP] Regex for telephone numbers

2010-12-29 Thread Karl DeSaulniers
You could also help them out a little with something like.. $phone = str_replace((, , $phone); $phone = str_replace(), -, $phone); HTH, Karl On Dec 29, 2010, at 6:27 PM, Josh Kehn wrote: On Dec 29, 2010, at 7:12 PM, Ethan Rosenberg eth...@earthlink.net wrote: Dear List - Thank you

Re: [PHP] Re: [PHP-DB] Re: [PHP] Regex for telephone numbers

2010-12-29 Thread Alexis
Why not have three separate fields for each part, as that way you don't need to bother about how the user separates them, as trust me, if they can break it, they will. I have found it is best to always limit the amount of free entry you permit a user, as that will drastically cut back in data

Re: [PHP] Regex for telephone numbers

2010-12-29 Thread Daniel P. Brown
On Wed, Dec 29, 2010 at 19:12, Ethan Rosenberg eth...@earthlink.net wrote: Dear List - Thank you for all your help in the past. Here is another one I would like to have a regex  which would validate that a telephone number is in the format xxx-xxx-. Congrats. People in Hell

Re: [PHP] regex pattern for extracting URLs

2009-10-23 Thread Jim Lucas
Brad Fuller wrote: I'm looking for a regular expression to accomplish a specific task. I'm hoping someone who's really good at regex patterns can lend a quick hand. I need a regex pattern that will grab URLs out of HTML that have a certain link text. (i.e. the word Continue) This is

Re: [PHP] regex pattern for extracting URLs

2009-10-23 Thread Ashley Sheridan
On Fri, 2009-10-23 at 13:23 -0400, Brad Fuller wrote: I'm looking for a regular expression to accomplish a specific task. I'm hoping someone who's really good at regex patterns can lend a quick hand. I need a regex pattern that will grab URLs out of HTML that have a certain link text.

Re: [PHP] regex pattern for extracting URLs

2009-10-23 Thread Brad Fuller
On Fri, Oct 23, 2009 at 1:28 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Fri, 2009-10-23 at 13:23 -0400, Brad Fuller wrote: I'm looking for a regular expression to accomplish a specific task. I'm hoping someone who's really good at regex patterns can lend a quick hand. I need a

Re: [PHP] regex pattern for extracting URLs

2009-10-23 Thread Ashley Sheridan
On Fri, 2009-10-23 at 13:45 -0400, Brad Fuller wrote: On Fri, Oct 23, 2009 at 1:28 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Fri, 2009-10-23 at 13:23 -0400, Brad Fuller wrote: I'm looking for a regular expression to accomplish a specific task. I'm hoping someone who's

Re: [PHP] regex pattern for extracting URLs

2009-10-23 Thread Israel Ekpo
On Fri, Oct 23, 2009 at 1:48 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Fri, 2009-10-23 at 13:45 -0400, Brad Fuller wrote: On Fri, Oct 23, 2009 at 1:28 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Fri, 2009-10-23 at 13:23 -0400, Brad Fuller wrote: I'm

Re: [PHP] regex pattern for extracting URLs

2009-10-23 Thread Brad Fuller
On Fri, Oct 23, 2009 at 1:48 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Fri, 2009-10-23 at 13:45 -0400, Brad Fuller wrote: On Fri, Oct 23, 2009 at 1:28 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Fri, 2009-10-23 at 13:23 -0400, Brad Fuller wrote: I'm looking

Re: [PHP] regex pattern for extracting URLs

2009-10-23 Thread Brad Fuller
On Fri, Oct 23, 2009 at 1:54 PM, Israel Ekpo israele...@gmail.com wrote: On Fri, Oct 23, 2009 at 1:48 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Fri, 2009-10-23 at 13:45 -0400, Brad Fuller wrote: On Fri, Oct 23, 2009 at 1:28 PM, Ashley Sheridan

Re: [PHP] regex pattern for extracting URLs

2009-10-23 Thread Paul M Foster
On Fri, Oct 23, 2009 at 01:54:40PM -0400, Brad Fuller wrote: Thanks Ash you are awesome! Brad, you're violating list rules. We never say that kind of thing to Ash *where he can hear it*. Only behind his back. ;-} Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] regex pattern for extracting URLs

2009-10-23 Thread Ashley Sheridan
On Fri, 2009-10-23 at 15:17 -0400, Paul M Foster wrote: On Fri, Oct 23, 2009 at 01:54:40PM -0400, Brad Fuller wrote: Thanks Ash you are awesome! Brad, you're violating list rules. We never say that kind of thing to Ash *where he can hear it*. Only behind his back. ;-} Paul --

Re: [PHP] regex for multiple line breakes

2009-10-14 Thread Fernando Castillo Aparicio
You are replacing 1 or more matchs of a new line. To match 2 or more you can use {2,}. It's a range, first number means min matches, second max matches. Omitting last number means no max limit. $data[txt] = preg_replace('`[\r\n]{2,}`',\n,$data[txt]); De:

Re: [PHP] regex for multiple line breakes

2009-10-14 Thread Merlin Morgenstern
That sounds very logical but does not work unfortunatelly. The result is the same. It removes all linebreakes but one. I would like to pass this one: - first line second third - But not this one: - third forth Fernando Castillo Aparicio schrieb: You are

Re: [PHP] regex for multiple line breakes

2009-10-14 Thread Ashley Sheridan
On Wed, 2009-10-14 at 12:42 +0200, Merlin Morgenstern wrote: That sounds very logical but does not work unfortunatelly. The result is the same. It removes all linebreakes but one. I would like to pass this one: - first line second third - But not this one:

Re: [PHP] regex for multiple line breakes

2009-10-14 Thread Fernando Castillo Aparicio
a...@ashleysheridan.co.uk Para: Merlin Morgenstern merli...@fastmail.fm CC: php-general@lists.php.net Enviado: mié,14 octubre, 2009 12:44 Asunto: Re: [PHP] regex for multiple line breakes On Wed, 2009-10-14 at 12:42 +0200, Merlin Morgenstern wrote: That sounds very logical but does not work

Re: [PHP] regex for multiple line breakes

2009-10-14 Thread Merlin Morgenstern
Ashley Sheridan schrieb: On Wed, 2009-10-14 at 12:42 +0200, Merlin Morgenstern wrote: That sounds very logical but does not work unfortunatelly. The result is the same. It removes all linebreakes but one. I would like to pass this one: - first line second third - But not

Re: [PHP] regex - filtering out chinese utf8 characters

2009-07-30 Thread Stuart Connolly
Hi Merlin, I think the pattern you're looking for is '/[a-zA-Z0-9]/' which will match all alphanumeric characters. Cheers Stuart On 30 Jul 2009, at 19:13, Merlin Morgenstern wrote: Hi there, I am trying to filter out content that is not ascii. Can I do this with regex? For example:

Re: [PHP] regex - filtering out chinese utf8 characters

2009-07-30 Thread Daniel Kolbo
Merlin Morgenstern wrote: Hi there, I am trying to filter out content that is not ascii. Can I do this with regex? For example: $regex = '[AZ][09]'; if (preg_match($regex, $text)) { return TRUE; } else { return FALSE; } The reason I need to do

Re: [PHP] regex - filtering out chinese utf8 characters

2009-07-30 Thread Jim Lucas
Merlin Morgenstern wrote: Hi there, I am trying to filter out content that is not ascii. Can I do this with regex? For example: $regex = '[AZ][09]'; if (preg_match($regex, $text)) { return TRUE; } else { return FALSE; } The reason I need to do

RE: [PHP] Regex not working with :

2009-04-22 Thread kyle.smith
Have you tried escaping the : with a \? Like: mb_ereg_replace('^(.*)this is the test\: replace(.*)$', '', $contents ,'UTF-8'); Also, have you tried removing the : and adjusting the input string to verify your belief that it's the :? HTH, Kyle -Original Message- From: Merlin Morgenstern

Re: [PHP] Regex not working with :

2009-04-22 Thread Richard Quadling
2009/4/22 kyle.smith kyle.sm...@inforonics.com: Have you tried escaping the : with a \? Like: mb_ereg_replace('^(.*)this is the test\: replace(.*)$', '', $contents ,'UTF-8'); Also, have you tried removing the : and adjusting the input string to verify your belief that it's the :? HTH,

Re: [PHP] Regex not working with :

2009-04-22 Thread Merlin Morgenstern
Richard Quadling wrote: 2009/4/22 kyle.smith kyle.sm...@inforonics.com: Have you tried escaping the : with a \? Like: mb_ereg_replace('^(.*)this is the test\: replace(.*)$', '', $contents ,'UTF-8'); Also, have you tried removing the : and adjusting the input string to verify your belief

Re: [PHP] Regex

2009-03-27 Thread Jochem Maas
jesse.ha...@arvatousa.com schreef: Hi, Brand new to regex. So I have a cli which runs a regex on users input, to make sure that only 0-9 and A-Z are accepted. It should strip everything else. My problem is that when you press control-Z (on Windows; I have not yet tested this on linux,

RE: [PHP] Regex

2009-03-27 Thread Bob McConnell
From: Nitsan Bin-Nun If you can point me on the character which control-z creates it would make it easier, I have no idea of it ;) On Thu, Mar 26, 2009 at 11:06 PM, jesse.ha...@arvatousa.com wrote: Thanks again. Sad to say, same result. The second option looped an error: Warning:

RE: [PHP] Regex

2009-03-27 Thread Jesse.Hazen
Hazen -Original Message- From: Jochem Maas [mailto:joc...@iamjochem.com] Sent: Thursday, March 26, 2009 11:45 PM To: Hazen, Jesse, arvato digital services llc Cc: php-general@lists.php.net Subject: Re: [PHP] Regex jesse.ha...@arvatousa.com schreef: Hi, Brand new to regex. So I have

RE: [PHP] Regex

2009-03-27 Thread Jesse.Hazen
, 2009 5:23 PM To: Hazen, Jesse, arvato digital services llc; php-general@lists.php.net Subject: RE: [PHP] Regex hi... if you haven't solved your issue... can you tell me in detail what you're trying to accomplish? what are the steps to running the script? thanks -Original Message- From

RE: [PHP] Regex

2009-03-27 Thread Jesse.Hazen
: php-general@lists.php.net Subject: Re: [PHP] Regex jesse.ha...@arvatousa.com schreef: Hi, Brand new to regex. So I have a cli which runs a regex on users input, to make sure that only 0-9 and A-Z are accepted. It should strip everything else. My problem is that when you press control-Z

Re: [PHP] Regex help please

2009-03-27 Thread haliphax
On Fri, Mar 27, 2009 at 9:40 AM, Shawn McKenzie nos...@mckenzies.net wrote: I'm normally OK with regex, especially if I fiddle with it long enough, however I have fiddled with this one so long that I'm either totally missing it or it's something simple.  Does it have anything to do with the

Re: [PHP] Regex help please

2009-03-27 Thread Shawn McKenzie
haliphax wrote: On Fri, Mar 27, 2009 at 9:40 AM, Shawn McKenzie nos...@mckenzies.net wrote: I'm normally OK with regex, especially if I fiddle with it long enough, however I have fiddled with this one so long that I'm either totally missing it or it's something simple. Does it have anything

Re: [PHP] Regex

2009-03-26 Thread Nitsan Bin-Nun
To filter out everything which is not A-Z, a-z and 0-9 try this regex: $str = preg_replace(#[^a-zA-Z0-9]+#is, , $str); On Thu, Mar 26, 2009 at 10:23 PM, jesse.ha...@arvatousa.com wrote: Hi, Brand new to regex. So I have a cli which runs a regex on users input, to make sure that only 0-9

RE: [PHP] Regex

2009-03-26 Thread Jesse.Hazen
, 2009 1:44 PM To: Hazen, Jesse, arvato digital services llc Cc: php-general@lists.php.net Subject: Re: [PHP] Regex To filter out everything which is not A-Z, a-z and 0-9 try this regex: $str = preg_replace(#[^a-zA-Z0-9]+#is, , $str); On Thu, Mar 26, 2009 at 10:23 PM, jesse.ha...@arvatousa.com

Re: [PHP] Regex

2009-03-26 Thread Nitsan Bin-Nun
*To:* Hazen, Jesse, arvato digital services llc *Cc:* php-general@lists.php.net *Subject:* Re: [PHP] Regex To filter out everything which is not A-Z, a-z and 0-9 try this regex: $str = preg_replace(#[^a-zA-Z0-9]+#is, , $str); On Thu, Mar 26, 2009 at 10:23 PM, jesse.ha...@arvatousa.com

RE: [PHP] Regex

2009-03-26 Thread Jesse.Hazen
] On Behalf Of Nitsan Bin-Nun Sent: Thursday, March 26, 2009 1:58 PM To: Hazen, Jesse, arvato digital services llc Cc: php-general@lists.php.net Subject: Re: [PHP] Regex I have no idea about this control-Z thing, you might want to try it with UTF (just add the 'u' modificator): $str = preg_replace

Re: [PHP] Regex

2009-03-26 Thread Nitsan Bin-Nun
digital services llc *Cc:* php-general@lists.php.net *Subject:* Re: [PHP] Regex I have no idea about this control-Z thing, you might want to try it with UTF (just add the 'u' modificator): $str = preg_replace(#[^a-zA-Z0-9]+#uis, , $str); Or try this: $str = preg_replace(#(\b[^a-zA-Z0-9]\b

RE: [PHP] Regex

2009-03-26 Thread Jesse.Hazen
it. Thanks, Jesse Hazen From: nit...@binnun.co.il [mailto:nit...@binnun.co.il] On Behalf Of Nitsan Bin-Nun Sent: Thursday, March 26, 2009 2:09 PM To: Hazen, Jesse, arvato digital services llc Cc: php-general@lists.php.net Subject: Re: [PHP] Regex If you can point

RE: [PHP] Regex

2009-03-26 Thread Jesse.Hazen
: jesse.ha...@arvatousa.com [mailto:jesse.ha...@arvatousa.com] Sent: Thu 3/26/2009 2:17 PM To: nitsa...@gmail.com Cc: php-general@lists.php.net Subject: RE: [PHP] Regex Nitsan, Not a problem, thanks for the help. So, it is printed as ^Z. However, I created a little test.php script to accept input

RE: [PHP] Regex

2009-03-26 Thread bruce
hi... if you haven't solved your issue... can you tell me in detail what you're trying to accomplish? what are the steps to running the script? thanks -Original Message- From: jesse.ha...@arvatousa.com [mailto:jesse.ha...@arvatousa.com] Sent: Thursday, March 26, 2009 1:23 PM To:

Re: [PHP] Regex

2009-03-26 Thread Shawn McKenzie
jesse.ha...@arvatousa.com wrote: Nistan, Just got home, tested on linux. No problem on linux, the control-z just exits. I may just go ahead and post my issue to the PHP windows list to see if anything comes up, and not worry if it doesnt. I appreciate the help very much Thanks,

RE: [PHP] Regex Problem

2008-12-18 Thread Boyd, Todd M.
-Original Message- From: MikeP [mailto:mpel...@princeton.edu] Sent: Thursday, December 18, 2008 8:43 AM To: php-general@lists.php.net Subject: [PHP] Regex Problem Hello, I have a quirky behavior I'm trying to resolve. I have a REGEX that will find a function definition in a php

Re: [PHP] Regex Problem

2008-12-18 Thread MikeP
Boyd, Todd M. tmbo...@ccis.edu wrote in message news:33bde0b2c17eef46acbe00537cf2a190037b7...@exchcluster.ccis.edu... -Original Message- From: MikeP [mailto:mpel...@princeton.edu] Sent: Thursday, December 18, 2008 8:43 AM To: php-general@lists.php.net Subject: [PHP] Regex Problem

Re: [PHP] RegEx to check for non-Latin characters

2008-11-15 Thread Richard Heyes
For a Form Validation process, I need a function to avoid Latin characters to be provided as the first or last name. Since we expect our users to enter their personal info in Persian. Do you know any regular expression to provide this functionality? 1) Regex to check whether there are Latin

Re: [PHP] RegEx to check for non-Latin characters

2008-11-15 Thread Yeti
Hi Behzad, I would try a different approach ... EXAMPLE (UTF-8): !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 /

Re: [PHP] RegEx to check for non-Latin characters

2008-11-15 Thread Behzad
Thanks everyone. I guess I find the answer: *// return true if the $str ONLY consists of Arabic characters and space-character public function isArabicString($str) { return preg_match('/^([\p{Arabic}]|\s)*$/u', $str); } * PHP 5.1.x or higher is required. @see:

Re: [PHP] Regex validation

2008-10-30 Thread Yeti
After ceo posted about the imap function I was eager to try it out and got rather disappointed pretty soon. imap_rfc822_parse_adrlist() should not be used for email validation! EXAMPLE: ?php var_dump(imap_rfc822_parse_adrlist('! # $ % * + - / = ? ^ _ ` { | } ~', '')); ? The above code will

Re: [PHP] Regex validation

2008-10-30 Thread ceo
var_dump(imap_rfc822_parse_adrlist('! # $ % * + - / = ? ^ _ ` { | } ~', '')); This looks like a valid localhost email address to me... What's wrong with it? :-v You may want to check that host is non-empty, if you do not expect any localhost users, and fail on that condition,

Re: [PHP] Regex validation

2008-10-30 Thread Yeti
ceo wrote: var_dump(imap_rfc822_parse_adrlist('! # $ % * + - / = ? ^ _ ` { | } ~', '')); This looks like a valid localhost email address to me... It surely is a valid localhost email address, but what most people (and the OP) usually need is to validate a full email string with a local and a

Re: [PHP] Regex validation

2008-10-29 Thread Bastien Koert
On Tue, Oct 28, 2008 at 8:57 PM, VamVan [EMAIL PROTECTED] wrote: SSO process: $_POST the Email Address and password Get Authenticated, Get the COOKIE ( Through Oracle IDM suite SOAP call) Decrypt the COOKIE ( Through Oracle Enterprise business suite SOAP call) and get the profile Info

Re: [PHP] Regex validation

2008-10-29 Thread ceo
When it comes to email validation, I would recommend using the IMAP function which will be both fast and correct: http://us.php.net/manual/en/function.imap-rfc822-parse-adrlist.php Otherwise, it's guaranteed that you are having at least some false positives, and probably some false

Re: [PHP] Regex validation

2008-10-29 Thread Yeti
On Wed, Oct 29, 2008 at 5:36 AM, [EMAIL PROTECTED] wrote: When it comes to email validation, I would recommend using the IMAP function which will be both fast and correct: http://us.php.net/manual/en/function.imap-rfc822-parse-adrlist.php Otherwise, it's guaranteed that you are having at

Re: [PHP] Regex validation

2008-10-28 Thread Daniel P. Brown
On Tue, Oct 28, 2008 at 4:10 PM, VamVan [EMAIL PROTECTED] wrote: Hello Team of Nerds, I need help in writing a regular expression for this: invalid character set is: INVALID_STRING={/,*,+,(,),'\',:,;,~,..,.@,@.}; Then you need to STFW and RTFM. PHP uses Perl-style regexp's, by the

Re: [PHP] Regex validation

2008-10-28 Thread Richard Heyes
Hello Team of Nerds, Not the best way to start your request for help. I need help in writing a regular expression for this: invalid character set is: INVALID_STRING={/,*,+,(,),'\',:,;,~,..,.@,@.}; I want to a pregmatch for these characters on my whole email address and if match is

Re: [PHP] Regex validation

2008-10-28 Thread Micah Gersten
VamVan wrote: Hello Team of Nerds, I need help in writing a regular expression for this: invalid character set is: INVALID_STRING={/,*,+,(,),'\',:,;,~,..,.@,@.}; I want to a pregmatch for these characters on my whole email address and if match is found I need to return false.

RE: [PHP] Regex validation

2008-10-28 Thread Boyd, Todd M.
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Richard Heyes Sent: Tuesday, October 28, 2008 4:30 PM To: VamVan Cc: php List Subject: Re: [PHP] Regex validation Hello Team of Nerds, Not the best way to start your request for help. I

Re: [PHP] Regex validation

2008-10-28 Thread Yeti
If your trying to filter E-Mail addresses, then filter_var is what you should use: http://php.net/filter_var If the OP (original poster) got PHP5+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Regex validation

2008-10-28 Thread Nitsan Bin-Nun
Good to know filter_var() exists in PHP5 Unless you have PHP5 you better validate the string in the way of checking if it is fit's to your allowed characters and not checking if it contains the NOT allowed charaters. You better use: [a-z0-9A-Z\_\.]+ instead of [^\)\(\*\[EMAIL PROTECTED] and I

Re: [PHP] Regex validation

2008-10-28 Thread VamVan
Thank Guys, I at least got part of it working , not the double words but almost everything else than that: function _email_validate($mail_address){ $invalid_charset_pattern = [(*+?)|~:;{}/ ]; if(ereg($invalid_charset_pattern, $mail_address)){ return false; }else{ return true; } }

Re: [PHP] Regex validation

2008-10-28 Thread Micah Gersten
Keep in mind that ereg will disappear with PHP 6. You might want to use the preg functions: http://www.making-the-web.com/2007/09/21/becoming-php-6-compatible/ Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com VamVan wrote: Thank Guys, I at least got part

Re: [PHP] Regex validation

2008-10-28 Thread Ashley Sheridan
On Tue, 2008-10-28 at 18:07 -0500, Micah Gersten wrote: Keep in mind that ereg will disappear with PHP 6. You might want to use the preg functions: http://www.making-the-web.com/2007/09/21/becoming-php-6-compatible/ Thank you, Micah Gersten onShore Networks Internal Developer

Re: [PHP] Regex validation

2008-10-28 Thread VamVan
Yeah, I understand that its allowed in RFC. But unfortunately I use SSO layer which decrypts the Cookie to get email address. This is where it messes up. So I have decided not to allow people to use that as well. Thanks On Tue, Oct 28, 2008 at 5:10 PM, Ashley Sheridan [EMAIL PROTECTED]wrote:

Re: [PHP] Regex validation

2008-10-28 Thread Lupus Michaelis
VamVan a écrit : This is where it messes up. So I have decided not to allow people to use that as well. By that way, you're making a lot of ennemies on this very list :D -- Mickaël Wolff aka Lupus Michaelis http://lupusmic.org -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] Regex validation

2008-10-28 Thread Micah Gersten
What are you talking about with a cookie and an E-Mail address? Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com VamVan wrote: Yeah, I understand that its allowed in RFC. But unfortunately I use SSO layer which decrypts the Cookie to get email address.

Re: [PHP] Regex validation

2008-10-28 Thread VamVan
SSO process: $_POST the Email Address and password Get Authenticated, Get the COOKIE ( Through Oracle IDM suite SOAP call) Decrypt the COOKIE ( Through Oracle Enterprise business suite SOAP call) and get the profile Info Thats what happens now. But there is a glitch in the decryption

Re: [PHP] Regex validation

2008-10-28 Thread Micah Gersten
How is anything but your webserver decrypting the $_POST data? PHP should get it after that as is. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com VamVan wrote: SSO process: $_POST the Email Address and password Get Authenticated, Get the COOKIE (

RE: [PHP] Regex help

2008-09-09 Thread Boyd, Todd M.
-Original Message- From: Jason Pruim [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 09, 2008 7:30 AM To: PHP-General List Subject: [PHP] Regex help Hey everyone, Not completely specific to php but I know you guys know regex's better then I do! :) I am attempting to match

  1   2   3   4   5   6   >