[PHP] Regex

2012-07-27 Thread 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 Thanks. Ethan Rosenberg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

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,

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

2011-08-09 Thread Daevid Vincent
I've inherited a bunch of code and the previous developers have done two things that are really bugging me and I want to clean up. [a] They use short-tag ? instead of ?php. Anyone have some good search/replace style Regex (ideally for ZendStudio/Eclipse) that will run through all the files in

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

[PHP] Regex for extracting quoted strings

2011-03-05 Thread Mark Kelly
Hi. I'm hoping someone can help me extract text between double quotes from a string. $regex = 'some magic'; $r = preg_match($regex, $sentence, $phrases); So, if $sentence = 'Dave said This is it. Nope, that is the wrong colour she replied.'; I want $phrases to contain 'This is it' and

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

[PHP] Regex pattern for preg_match_all

2011-02-18 Thread Tommy Pham
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 class=small tab a class=y-mast-link images

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

[PHP] Regex for ... genealogical names

2011-01-01 Thread Lester Caine
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 of scanning for the capitals and splitting this to give me

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
://www.ashleysheridan.co.uk - Reply message - From: Ethan Rosenberg eth...@earthlink.net Date: Fri, Dec 31, 2010 14:03 Subject: [PHP] Regex for telephone numbers To: Nathan Rixham nrix...@gmail.com Cc: php-general@lists.php.net php-general@lists.php.net At 07:11 AM 12/31/2010, Nathan Rixham wrote

Re: [PHP] Regex for telephone numbers

2010-12-31 Thread Ethan Rosenberg
my mobile as a means of contact. Thanks, Ash http://www.ashleysheridan.co.ukhttp://www.ashleysheridan.co.uk - Reply message - From: Ethan Rosenberg eth...@earthlink.net Date: Fri, Dec 31, 2010 14:03 Subject: [PHP] Regex for telephone numbers To: Nathan Rixham nrix...@gmail.com Cc: php

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:

[PHP] Regex for telephone numbers

2010-12-29 Thread Ethan Rosenberg
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 [Debian (sid)] -- PHP General Mailing List

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

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
; php-general@lists.php.net Subject: [PHP] Regex for telephone numbers 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 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

[PHP] regex pattern for extracting URLs

2009-10-23 Thread Brad Fuller
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 what I have so far but it does

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 --

[PHP] regex for multiple line breakes

2009-10-14 Thread Merlin Morgenstern
Hi there, I am trying to remove multiple linebreakes from a textarea input. Spammers tend to insert multiple line breakes. The problem is, that I want to allow 2 line breaks so basic formating should be allowed. I am doing this by regex: $data[txt] = preg_replace('`[\r\n]+`',\n,$data[txt]);

Re: [PHP] regex for multiple line breakes

2009-10-14 Thread Fernando Castillo Aparicio
: Merlin Morgenstern merli...@fastmail.fm Para: php-general@lists.php.net Enviado: mié,14 octubre, 2009 12:17 Asunto: [PHP] regex for multiple line breakes Hi there, I am trying to remove multiple linebreakes from a textarea input. Spammers tend to insert multiple line breakes. The problem is, that I

Re: [PHP] regex for multiple line breakes

2009-10-14 Thread Merlin Morgenstern
Morgenstern merli...@fastmail.fm Para: php-general@lists.php.net Enviado: mié,14 octubre, 2009 12:17 Asunto: [PHP] regex for multiple line breakes Hi there, I am trying to remove multiple linebreakes from a textarea input. Spammers tend to insert multiple line breakes. The problem is, that I want

Re: [PHP] regex for multiple line breakes

2009-10-14 Thread Ashley Sheridan
] = preg_replace('`[\r\n]{2,}`',\n,$data[txt]); De: Merlin Morgenstern merli...@fastmail.fm Para: php-general@lists.php.net Enviado: mié,14 octubre, 2009 12:17 Asunto: [PHP] regex for multiple line breakes Hi there, I am trying to remove

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
] = preg_replace('`[\r\n]{2,}`',\n,$data[txt]); De: Merlin Morgenstern merli...@fastmail.fm Para: php-general@lists.php.net Enviado: mié,14 octubre, 2009 12:17 Asunto: [PHP] regex for multiple line breakes Hi there, I am trying to remove multiple linebreakes from

[PHP] Regex Problem

2009-07-31 Thread Igor Escobar
Hi Folks, I have a serious problem. must create a regular expression against all that is between single quote or double quotes. Easy? Ok, i know, but i need that everything must to be too an single quote or double quote. If i have this SQL command: SELECT * FROM TSTRENIC.MEI_ACESSO WHERE

[PHP] regex - filtering out chinese utf8 characters

2009-07-30 Thread Merlin Morgenstern
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 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

[PHP] Regex not working with :

2009-04-22 Thread Merlin Morgenstern
Hi there, I am trying to remove a text which does contain a : inside. Somehow the regex does not match, no matter what I do: $contents = mb_ereg_replace('^(.*)this is the test: replace(.*)$', '', $contents ,'UTF-8'); Looks like this is a result of the :. Does anybody have an idea how to

RE: [PHP] Regex not working with :

2009-04-22 Thread kyle.smith
[mailto:merli...@fastmail.fm] Sent: Wednesday, April 22, 2009 4:09 AM To: php-general@lists.php.net Subject: [PHP] Regex not working with : Hi there, I am trying to remove a text which does contain a : inside. Somehow the regex does not match, no matter what I do: $contents = mb_ereg_replace

Re: [PHP] Regex not working with :

2009-04-22 Thread Richard Quadling
, Kyle -Original Message- From: Merlin Morgenstern [mailto:merli...@fastmail.fm] Sent: Wednesday, April 22, 2009 4:09 AM To: php-general@lists.php.net Subject: [PHP] Regex not working with : Hi there, I am trying to remove a text which does contain a : inside. Somehow the regex does

Re: [PHP] Regex not working with :

2009-04-22 Thread Merlin Morgenstern
that it's the :? HTH, Kyle -Original Message- From: Merlin Morgenstern [mailto:merli...@fastmail.fm] Sent: Wednesday, April 22, 2009 4:09 AM To: php-general@lists.php.net Subject: [PHP] Regex not working with : Hi there, I am trying to remove a text which does contain a : inside. Somehow

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

[PHP] Regex help please

2009-03-27 Thread Shawn McKenzie
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 backref, or the fact that the value of the backref has a $? I have: $out = '

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

[PHP] Regex

2009-03-26 Thread Jesse.Hazen
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, and I will, but I would like this to be

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
-general@lists.php.net Subject: [PHP] Regex 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-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,

[PHP] Regex Problem

2008-12-18 Thread MikeP
Hello, I have a quirky behavior I'm trying to resolve. I have a REGEX that will find a function definition in a php file: .function InsertQuery($table,$fields,$values). the REGEX is: $regex='/function [a-z]* *([$a-zA-Z]*)/'; the problem is that: 1. a slash is automattically put in front

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:

[PHP] RegEx to check for non-Latin characters

2008-11-14 Thread Behzad
Dear List, 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

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

  1   2   3   4   5   6   7   8   >