[PHP] Regular expressions, filter option1 OR option2

2010-08-18 Thread Camilo Sperberg
Hello list :) Just a short question which I know it should be easy, but I'm no expert yet in regular expressions. I've got a nice little XML string, which is something like this but can be changed: ?xml version=1.0 encoding=utf-8? boolean xmlns=http://tempuri.org/;false/boolean The boolean

Re: [PHP] Regular expressions, filter option1 OR option2

2010-08-18 Thread Shreyas Agasthya
Camilo, What exactly are you trying to achieve? Meaning: if (true) do this; if (false) do that; However, here's a link that I used long back to help me with some RegEx : http://www.gskinner.com/RegExr/ Regards, Shreyas On Wed, Aug 18, 2010 at 11:31 PM, Camilo Sperberg

Re: [PHP] Regular expressions, filter option1 OR option2

2010-08-18 Thread Ashley Sheridan
On Wed, 2010-08-18 at 23:36 +0530, Shreyas Agasthya wrote: Camilo, What exactly are you trying to achieve? Meaning: if (true) do this; if (false) do that; However, here's a link that I used long back to help me with some RegEx : http://www.gskinner.com/RegExr/ Regards,

Re: [PHP] Regular expressions, filter option1 OR option2

2010-08-18 Thread Camilo Sperberg
On Wed, Aug 18, 2010 at 15:01, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Wed, 2010-08-18 at 23:36 +0530, Shreyas Agasthya wrote: Camilo, What exactly are you trying to achieve? Meaning: if (true) do this; if (false) do that; However, here's a link that I used long back

[PHP] Regular expressions (regex) question for parsing

2008-12-22 Thread Rene Fournier
Hi, I'm looking for some ideas on the best way to parse blocks of text that is formatted such as: $sometext %\r\n -- good data $otherstring %\r\n -- good data $andyetmoretext %\r\n

Re: [PHP] Regular expressions (regex) question for parsing

2008-12-22 Thread Daniel Brown
On Mon, Dec 22, 2008 at 15:56, Rene Fournier renefourn...@gmail.com wrote: Each line should start with a $dollar sign, then some arbitrary text, ends with a percent sign, followed by carriage-return and line-feed. Sometimes though, the final line is not complete. In that case, I want to save

Re: [PHP] Regular expressions (regex) question for parsing

2008-12-22 Thread Jim Lucas
Rene Fournier wrote: Hi, I'm looking for some ideas on the best way to parse blocks of text that is formatted such as: $sometext %\r\n-- good data $otherstring %\r\n-- good data $andyetmoretext %\r\n-- good data

Re: [PHP] Regular expressions (regex) question for parsing

2008-12-22 Thread Lars Torben Wilson
2008/12/22 Jim Lucas li...@cmsws.com: Rene Fournier wrote: Hi, I'm looking for some ideas on the best way to parse blocks of text that is formatted such as: $sometext %\r\n-- good data $otherstring %\r\n-- good data $andyetmoretext %\r\n

Re: [PHP] regular expressions question

2008-03-07 Thread Richard Lynch
it. I tried the code you posted, for now it is blocking blank fields. Thank you - Original Message From: Richard Lynch [EMAIL PROTECTED] To: Adil Drissi [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Tuesday, March 4, 2008 3:09:09 PM Subject: Re: [PHP] regular expressions

Re: [PHP] regular expressions question

2008-03-05 Thread It Maq
PROTECTED] To: Adil Drissi [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Tuesday, March 4, 2008 3:09:09 PM Subject: Re: [PHP] regular expressions question On Tue, March 4, 2008 1:19 pm, Adil Drissi wrote: Is there any way to limit the user to a set of characters for example say i want my user

Re: [PHP] regular expressions question

2008-03-05 Thread Robert Cummings
- Original Message From: Richard Lynch [EMAIL PROTECTED] To: Adil Drissi [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Tuesday, March 4, 2008 3:09:09 PM Subject: Re: [PHP] regular expressions question On Tue, March 4, 2008 1:19 pm, Adil Drissi wrote: Is there any way

[PHP] regular expressions question

2008-03-04 Thread Adil Drissi
Hi, Is there any way to limit the user to a set of characters for example say i want my user to enter any character between a and z (case insensitive). And if the user enters just one letter not belonging to [a-z], this will not be accepted. I tried eregi('[a-z]', $fname) but this allows the

Re: [PHP] regular expressions question

2008-03-04 Thread David Giragosian
On 3/4/08, Adil Drissi [EMAIL PROTECTED] wrote: Hi, Is there any way to limit the user to a set of characters for example say i want my user to enter any character between a and z (case insensitive). And if the user enters just one letter not belonging to [a-z], this will not be accepted.

Re: [PHP] regular expressions question

2008-03-04 Thread Daniel Brown
On Tue, Mar 4, 2008 at 2:19 PM, Adil Drissi [EMAIL PROTECTED] wrote: Hi, Is there any way to limit the user to a set of characters for example say i want my user to enter any character between a and z (case insensitive). And if the user enters just one letter not belonging to [a-z], this

Re: [PHP] regular expressions question

2008-03-04 Thread Richard Lynch
On Tue, March 4, 2008 1:19 pm, Adil Drissi wrote: Is there any way to limit the user to a set of characters for example say i want my user to enter any character between a and z (case insensitive). And if the user enters just one letter not belonging to [a-z], this will not be accepted. I

Re: [PHP] regular expressions question

2008-03-04 Thread Adil Drissi
Thank you guys, The answers you gave me not only solved the problem, but i included more characters like space and -. Thank you again --- Richard Lynch [EMAIL PROTECTED] wrote: On Tue, March 4, 2008 1:19 pm, Adil Drissi wrote: Is there any way to limit the user to a set of characters for

Re: [PHP] Regular expressions

2007-12-12 Thread tedd
At 2:04 AM -0500 12/12/07, Robert Cummings wrote: ?php if( strlen( $pw1 ) 6 || !ereg( '[[:digit:]]', $pw1 ) || strlen( ereg_replace( '[^[:alpha:]]', '', $pw1 ) ) 2 || strlen( ereg_replace( '[[:alnum:][:space:]]', '', $pw1 ) ) 1 ) { // error message } ? Cheers,

[PHP] Regular expressions

2007-12-11 Thread Liz Kim
I am trying to do a password match with php.. It needs to be at least 6 characters, contains 2 alphabets and at least 1 number or a special character... if (!preg_match(/^.*(?=.{6,})((?=.*\d)|(?=.*[,[EMAIL PROTECTED]\/'+\*\?\.\[\]\^$\(\){}\|\\:;'~`#%_-]))([a-zA-Z]{2,}).*$/, $pw1)) {error

Re: [PHP] Regular expressions

2007-12-11 Thread Robert Cummings
On Tue, 2007-12-11 at 22:33 -0800, Liz Kim wrote: I am trying to do a password match with php.. It needs to be at least 6 characters, contains 2 alphabets and at least 1 number or a special character... if (!preg_match(/^.*(?=.{6,})((?=.*\d)|(?=.*[,[EMAIL

Re: [PHP] Regular Expressions

2007-11-07 Thread Mark Summers
There was no escaping in the original either. Also, I did assume that the list of replacements would grow to become pretty large. I wouldn't suggest doing this for a small list such as that given in the example. Robert Cummings wrote: On Wed, 2007-11-07 at 14:33 +, Mark Summers wrote:

Re: [PHP] Regular Expressions

2007-11-07 Thread Robert Cummings
On Wed, 2007-11-07 at 14:53 +, Mark Summers wrote: There was no escaping in the original either. Also, I did assume that the list of replacements would grow to become pretty large. I wouldn't suggest doing this for a small list such as that given in the example. Given that you expect

Re: [PHP] Regular Expressions

2007-11-07 Thread Mark Summers
This is a much better solution. I didn't realise that str_replace() accepted arrays as arguments for the search and replace terms. Mental note: reading mailing lists backwards doesn't work. Robert Cummings wrote: On Tue, 2007-11-06 at 23:24 -0300, Martin Alterisio wrote: 2007/11/6,

Re: [PHP] Regular Expressions

2007-11-07 Thread Robert Cummings
On Wed, 2007-11-07 at 14:33 +, Mark Summers wrote: This is a first attempt but the general idea is that the regular expression matching is done in one operation and then str_replace() is called only as many times as required instead of once for every line in your list. Also, str_replace()

Re: [PHP] Regular Expressions

2007-11-07 Thread Mark Summers
This is a first attempt but the general idea is that the regular expression matching is done in one operation and then str_replace() is called only as many times as required instead of once for every line in your list. Also, str_replace() is faster than ereg_replace(). ?php $replace = array(

[PHP] Regular Expressions

2007-11-06 Thread Alberto García Gómez
I'm a mess in regular expressions and I make this code: $link = ereg_replace('ntilde;','n',$link); $link = ereg_replace('aacute;','a',$link); $link = ereg_replace('eacute;','e',$link); $link = ereg_replace('iacute;','i',$link); $link = ereg_replace('oacute;','o',$link); $link =

Re: [PHP] Regular Expressions

2007-11-06 Thread Ezequiel Gutesman
Maybe this helps ?php $line = preg_replace_callback( '/(aacute;|eacute;|iacute;|oacute;|uacute;|ntilde;)/', create_function( // single quotes are essential here, // or alternative escape all $ as \$ '$matches',

Re: [PHP] Regular Expressions

2007-11-06 Thread Thiago Ferreira
you could do it without any function ?php $line = Hola que tal con aacute; con acento y entilde;e \n; echo preg_replace('/([aeioun])(acute|tilde);/i','\1',$line); ? On Nov 6, 2007 2:44 PM, Ezequiel Gutesman [EMAIL PROTECTED] wrote: Maybe this helps ?php $line = preg_replace_callback(

Re: [PHP] Regular Expressions

2007-11-06 Thread Ezequiel Gutesman
True, but you'll have to change the rexex not to match, 'nacute;' or 'atilde; for example (unless you want it) Thiago Ferreira wrote: you could do it without any function ?php $line = Hola que tal con aacute; con acento y entilde;e \n; echo

Re: [PHP] Regular Expressions

2007-11-06 Thread Jim Lucas
Alberto García Gómez wrote: I'm a mess in regular expressions and I make this code: $link = ereg_replace('ntilde;','n',$link); $link = ereg_replace('aacute;','a',$link); $link = ereg_replace('eacute;','e',$link); $link = ereg_replace('iacute;','i',$link); $link =

Re: [PHP] Regular Expressions

2007-11-06 Thread Martin Alterisio
2007/11/6, Alberto García Gómez [EMAIL PROTECTED]: I'm a mess in regular expressions and I make this code: $link = ereg_replace('ntilde;','n',$link); $link = ereg_replace('aacute;','a',$link); $link = ereg_replace('eacute;','e',$link); $link = ereg_replace('iacute;','i',$link); $link =

Re: [PHP] Regular Expressions

2007-11-06 Thread Robert Cummings
On Tue, 2007-11-06 at 23:24 -0300, Martin Alterisio wrote: 2007/11/6, Alberto García Gómez [EMAIL PROTECTED]: I'm a mess in regular expressions and I make this code: $link = ereg_replace('ntilde;','n',$link); $link = ereg_replace('aacute;','a',$link); $link =

Re: [PHP] Regular Expressions

2007-11-06 Thread Jim Lucas
Robert Cummings wrote: On Tue, 2007-11-06 at 23:24 -0300, Martin Alterisio wrote: 2007/11/6, Alberto García Gómez [EMAIL PROTECTED]: I'm a mess in regular expressions and I make this code: $link = ereg_replace('ntilde;','n',$link); $link = ereg_replace('aacute;','a',$link); $link =

Re: [PHP] Regular Expressions

2007-11-06 Thread Robert Cummings
On Tue, 2007-11-06 at 20:15 -0800, Jim Lucas wrote: Robert Cummings wrote: On Tue, 2007-11-06 at 23:24 -0300, Martin Alterisio wrote: 2007/11/6, Alberto García Gómez [EMAIL PROTECTED]: I'm a mess in regular expressions and I make this code: $link = ereg_replace('ntilde;','n',$link);

[PHP] Regular Expressions

2007-05-22 Thread Don Don
Hi all, am trying to run a regular expression to a list of user entered data on some forms. I've creating what i think is a matching pattern for each category as shown below: function validateEntry($regularExpression, $fieldValue) { if(preg_match($regularExpression, $fieldValue)) {

Re: [PHP] Regular Expressions

2007-05-22 Thread Zoltán Németh
2007. 05. 22, kedd keltezéssel 03.35-kor Don Don ezt írta: Hi all, am trying to run a regular expression to a list of user entered data on some forms. I've creating what i think is a matching pattern for each category as shown below: function validateEntry($regularExpression,

Re: [PHP] Regular Expressions

2007-05-22 Thread Tijnema
On 5/22/07, Zoltán Németh [EMAIL PROTECTED] wrote: 2007. 05. 22, kedd keltezéssel 03.35-kor Don Don ezt írta: Hi all, am trying to run a regular expression to a list of user entered data on some forms. I've creating what i think is a matching pattern for each category as shown below:

Re: [PHP] Regular Expressions

2007-05-22 Thread Jim Lucas
Don Don wrote: Hi all, am trying to run a regular expression to a list of user entered data on some forms. I've creating what i think is a matching pattern for each category as shown below: function validateEntry($regularExpression, $fieldValue) { if(preg_match($regularExpression,

Re: [PHP] Regular Expressions

2007-05-22 Thread Jochem Maas
Don Don wrote: Hi all, am trying to run a regular expression to a list of user entered data on some forms. I've creating what i think is a matching pattern for each category as shown below: function validateEntry($regularExpression, $fieldValue) { if(preg_match($regularExpression,

Re: [PHP] regular expressions

2006-11-30 Thread tedd
At 11:42 PM +0200 11/29/06, Dotan Cohen wrote: On 20/11/06, Paul Novitski [EMAIL PROTECTED] wrote: -snip- Paul, I just got around to reading this thread. The post of yours that I quote above has got to be one of the best posts that I've read in the 5 years that I've been on and off the php list.

Re: [PHP] regular expressions

2006-11-29 Thread Dotan Cohen
On 20/11/06, Paul Novitski [EMAIL PROTECTED] wrote: Børge, Here's how I would think this one through: First, I'm having to make several guesses at the nature of your text content: - You use the single word topic but I'll assume this can be multiple words and spaces. - Your source string

[PHP] regular expressions

2006-11-18 Thread Børge Holen
Ok I seem to need to learn regular expressions more than anything. this is what im working on: [desc] = c FF topic c 99 rest of the text , $string = preg_replace(/c\s\w[0-9A-F]+/,,$string); prints out: topic rest of the text ( with double spaces :(, I thought \s would fix

Re: [PHP] Regular expressions

2006-11-15 Thread John Meyer
Darrell Brogdon wrote: Can you elaborate a little? Do you mean that you want certain letters to have a numeric representation? -D no, what I was meaning was in relationship to each other, whether they are the same letter or not. -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] Regular expressions

2006-11-15 Thread Dave Goodchild
Is there a way to make a regular expression to match on a particular way the letters are arranged? For instance, if you had a word: THAT It could match on any word in the dictionary that had the form: 1231 preg_,match('/^(\w){1}\w\w\1$/'); would match the above on a single line for

Re: [PHP] Regular expressions

2006-11-15 Thread John Meyer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Okay, what I am referring to is cryptograms, where one letter is substituted for another. I would like to be able to list all the words in a dictionary that have that arrangement of their letters. Later on, I would like to be able to do an entire

Re: [PHP] Regular expressions

2006-11-15 Thread David Tulloh
John Meyer wrote: Is there a way to make a regular expression to match on a particular way the letters are arranged? For instance, if you had a word: THAT It could match on any word in the dictionary that had the form: 1231 I think something like this might be possible using

[PHP] Regular expressions

2006-11-14 Thread John Meyer
Is there a way to make a regular expression to match on a particular way the letters are arranged? For instance, if you had a word: THAT It could match on any word in the dictionary that had the form: 1231 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] Regular expressions

2006-11-14 Thread Darrell Brogdon
Can you elaborate a little? Do you mean that you want certain letters to have a numeric representation? -D On Nov 14, 2006, at 6:57 PM, John Meyer wrote: Is there a way to make a regular expression to match on a particular way the letters are arranged? For instance, if you had a word:

Re: [PHP] Regular expressions

2006-10-17 Thread Richard Lynch
On Mon, October 16, 2006 4:01 pm, Curt Zirzow wrote: That makes me wonder.. according to the docs U inverts greediness, if you have... /foo.*?bar/U does that make .*? a greedy .* I believe I stubbed my toe on that fact once, yes... I always manage to mess up the greedy/ungreedy stuff, and

Re: [PHP] Regular expressions

2006-10-16 Thread Richard Lynch
On Sat, October 14, 2006 4:19 pm, Morten Twellmann wrote: I'm trying to understand these regular expressions, but I can't make them work... All I want to do, is to find the first occurrence of some text inside the HTML tags h1 and /h1. Example string: pOctober 14, 2006/ph1Welcome to my

[PHP] Regular expressions

2006-10-16 Thread Chrome
*edit* sorry I didn't think and just hit reply on this instead of reply all... sorry Richard */edit* [snip] .*? is kinda silly -- .* mean 0 or more characters, and ? means maybe but putting them together has no added value, so lose the ? [/snip] I could be wrong (and under the considerable

Re: [PHP] Regular expressions

2006-10-16 Thread Curt Zirzow
On 10/16/06, Chrome [EMAIL PROTECTED] wrote: *edit* sorry I didn't think and just hit reply on this instead of reply all... sorry Richard */edit* [snip] .*? is kinda silly -- .* mean 0 or more characters, and ? means maybe but putting them together has no added value, so lose the ? [/snip] I

Re: [PHP] Regular expressions

2006-10-16 Thread Richard Lynch
On Mon, October 16, 2006 2:54 pm, Chrome wrote: *edit* sorry I didn't think and just hit reply on this instead of reply all... sorry Richard */edit* [snip] .*? is kinda silly -- .* mean 0 or more characters, and ? means maybe but putting them together has no added value, so lose the ?

RE: [PHP] Regular expressions

2006-10-16 Thread Chrome
[snip] ? means maybe in some other place in PCRE. Or maybe that's POSIX. Never have figured that one out. [/snip] ? directly after an expression is equivalent to {0,1} (maybe) but after a quantifier (*, +, {}) means ungreedy I'm sure I'll be corrected if I'm wrong :) Dan --

Re: [PHP] Regular expressions

2006-10-16 Thread Morten Twellmann
-general@lists.php.net Sent: Monday, October 16, 2006 7:42 PM Subject: Re: [PHP] Regular expressions On Sat, October 14, 2006 4:19 pm, Morten Twellmann wrote: I'm trying to understand these regular expressions, but I can't make them work... All I want to do, is to find the first

Re: [PHP] Regular expressions

2006-10-16 Thread Curt Zirzow
On 10/16/06, Richard Lynch [EMAIL PROTECTED] wrote: On Mon, October 16, 2006 2:54 pm, Chrome wrote: *edit* sorry I didn't think and just hit reply on this instead of reply all... sorry Richard */edit* [snip] .*? is kinda silly -- .* mean 0 or more characters, and ? means maybe but

Re: [PHP] Regular expressions

2006-10-16 Thread Curt Zirzow
On 10/16/06, Chrome [EMAIL PROTECTED] wrote: [snip] ? means maybe in some other place in PCRE. Or maybe that's POSIX. Never have figured that one out. [/snip] ? directly after an expression is equivalent to {0,1} (maybe) but after a quantifier (*, +, {}) means ungreedy I kind of talked about

RE: [PHP] Regular expressions

2006-10-16 Thread Chrome
On 10/16/06, Chrome [EMAIL PROTECTED] wrote: [snip] ? means maybe in some other place in PCRE. Or maybe that's POSIX. Never have figured that one out. [/snip] ? directly after an expression is equivalent to {0,1} (maybe) but after a quantifier (*, +, {}) means ungreedy I kind of talked

[PHP] Regular expressions

2006-10-14 Thread Morten Twellmann
I'm trying to understand these regular expressions, but I can't make them work... All I want to do, is to find the first occurrence of some text inside the HTML tags h1 and /h1. Example string: pOctober 14, 2006/ph1Welcome to my homepage/h1pWe're happy to announce.../p must return: Welcome to

Re: [PHP] Regular expressions

2006-10-14 Thread Penthexquadium
On Sat, 14 Oct 2006 23:19:13 +0200, Morten Twellmann [EMAIL PROTECTED] wrote: I'm trying to understand these regular expressions, but I can't make them work... All I want to do, is to find the first occurrence of some text inside the HTML tags h1 and /h1. Example string: pOctober 14,

Re: [PHP] regular expressions or something else?

2006-04-12 Thread Kim Christensen
On 4/12/06, Chris Westbrook [EMAIL PROTECTED] wrote: I have a problem. I'm trying to get a Google search results page via snoopy and then display the links of the results it returns in an application. I know about the fetchlinks function in snoopy, but I'm having trouble getting the text

[PHP] regular expressions or something else?

2006-04-11 Thread Chris Westbrook
I have a problem. I'm trying to get a Google search results page via snoopy and then display the links of the results it returns in an application. I know about the fetchlinks function in snoopy, but I'm having trouble getting the text between the a and /a tags. Yeah, I know, I should use

[PHP] regular expressions and Phone validation

2006-03-15 Thread Paul Goepfert
Hi all, I have one small problem I don't understand the preg_replace() method. I understand the gist of what it does but I still don't fully know what it does. I have read the entry in the php manual about this and I am still confused about it. I've never been any good with regular expressions.

RE: [PHP] regular expressions and Phone validation

2006-03-15 Thread Jay Blanchard
[snip] I have one small problem I don't understand the preg_replace() method. I understand the gist of what it does but I still don't fully know what it does. I have read the entry in the php manual about this and I am still confused about it. I've never been any good with regular expressions.

[PHP] Regular expressions

2005-10-09 Thread Gustav Wiberg
Hi there! I'm no good at reg exp... Yes, I confess.. Here's my code ?php $lines = file('export/nhExportVarupiraten.txt'); // Loop through our array, show HTML source as HTML source; and line numbers too. foreach ($lines as $line_num = $line) { echo Line #b{$line_num}/b : .

Re: [PHP] Regular expressions

2005-10-09 Thread Jasper Bryant-Greene
Gustav Wiberg wrote: ?php $lines = file('export/nhExportVarupiraten.txt'); // Loop through our array, show HTML source as HTML source; and line numbers too. foreach ($lines as $line_num = $line) { echo Line #b{$line_num}/b : . htmlspecialchars($line) . br /\n; if ($line_num 0 ) {

Re: [PHP] Regular expressions

2005-10-09 Thread Gustav Wiberg
- Original Message - From: Jasper Bryant-Greene [EMAIL PROTECTED] To: PHP General php-general@lists.php.net Sent: Sunday, October 09, 2005 8:06 PM Subject: Re: [PHP] Regular expressions Gustav Wiberg wrote: ?php $lines = file('export/nhExportVarupiraten.txt'); // Loop through our

Re: [PHP] Regular expressions book

2005-08-10 Thread Anas Mughal
The best I found is: O'Reilly book - Mastering Regular Expressions On 8/3/05, -k. [EMAIL PROTECTED] wrote: Has anyone here tried to learn Regular expressions with RegexBuddy? http://www.regular-expressions.info/regexbuddy.html It looks pretty cool, and even has some PHP specific

[PHP] Regular expressions book

2005-08-03 Thread Stefan Lemmen
Hi, I've want to dig a bit deeper into regular expressions for php. I wonder if anyone can help me choosing between 2 books I'm considering buying: 1. Open Source Regular Expression Recipes - Nathan A Good 2. Mastering Regular Expressions - Jeffrey Freidl If your using/reading one of these

Re: [PHP] Regular expressions book

2005-08-03 Thread Edward Vermillion
Stefan Lemmen wrote: Hi, I've want to dig a bit deeper into regular expressions for php. I wonder if anyone can help me choosing between 2 books I'm considering buying: 1. Open Source Regular Expression Recipes - Nathan A Good 2. Mastering Regular Expressions - Jeffrey Freidl If your

Re: [PHP] Regular expressions book

2005-08-03 Thread Steve Turnbull
On Wed, 03 Aug 2005 12:10:40 -0500, Edward Vermillion wrote: Stefan Lemmen wrote: Hi, I've want to dig a bit deeper into regular expressions for php. I wonder if anyone can help me choosing between 2 books I'm considering buying: 1. Open Source Regular Expression Recipes - Nathan A

Re: [PHP] Regular expressions book

2005-08-03 Thread -k.
Has anyone here tried to learn Regular expressions with RegexBuddy? http://www.regular-expressions.info/regexbuddy.html It looks pretty cool, and even has some PHP specific stuff, but you have to pay to play. -k. __ Do You Yahoo!? Tired of

Re: [PHP] Regular expressions problem

2005-04-30 Thread Khorosh Irani
For example I want to math this stream: 123 mm 334 What is the pattern that math with this stream? Thanks On 4/29/05, Malcolm Mill [EMAIL PROTECTED] wrote: What is it you want to do? On 4/29/05, Khorosh Irani [EMAIL PROTECTED] wrote: Hello I have a question: What is in the role of

Re: [PHP] Regular expressions problem

2005-04-30 Thread Rasmus Lerdorf
Khorosh Irani wrote: For example I want to math this stream: 123 mm 334 What is the pattern that math with this stream? Thanks 123[[:space:]]+mm[[:space:]]+334 -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Regular expressions problem

2005-04-30 Thread Matthew Weier O'Phinney
* Khorosh Irani [EMAIL PROTECTED]: For example I want to math this stream: 123 mm 334 What is the pattern that math with this stream? Depends on what regexp function you use, what exactly you want to match, and whether or not you want to know, after you match, any of the segments. Rasmus has

[PHP] Regular expressions problem

2005-04-29 Thread Khorosh Irani
Hello I have a question: What is in the role of space in the regular expressions (POSIX)? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] regular expressions

2005-04-14 Thread pete M
I've been messing about with this for a while to no avail.. so help would be appreciates I'm new to regular expressions and tried this with preg_replace, now I'm using eregi_replace ! here's the text $txt = 'span style=font-size: 10pt; font-family: Times New Roman;Itbr / blahh blahhh blahhh

Re: [PHP] regular expressions

2005-04-14 Thread Erwin Kerk
pete M wrote: I've been messing about with this for a while to no avail.. so help would be appreciates I'm new to regular expressions and tried this with preg_replace, now I'm using eregi_replace ! here's the text $txt = 'span style=font-size: 10pt; font-family: Times New Roman;Itbr / blahh

Re: [PHP] regular expressions

2005-04-14 Thread pete M
The pattern $pattern = 'font\-size:.*?\;'; throwns the error eregi_replace(): REG_BADRPT Erwin Kerk wrote: pete M wrote: I've been messing about with this for a while to no avail.. so help would be appreciates I'm new to regular expressions and tried this with preg_replace, now I'm using

Re: [PHP] regular expressions

2005-04-14 Thread Erwin Kerk
pete M wrote: The pattern $pattern = 'font\-size:.*?\;'; throwns the error eregi_replace(): REG_BADRPT Well, this should work (tested and all ) $pattern=|font\-size:.*?;|si; $txt = preg_replace( $pattern, , $txt ); Erwin --

Re: [PHP] regular expressions

2005-04-14 Thread pete M
Thankyou Diolch danka There seems to be a big difference between eregi_replace() and preg_replace Am reding teh Sams - Regular Expressions in 10 mins bu the syntax seems ot be different. !! regards pete Erwin Kerk wrote: pete M wrote: The pattern $pattern = 'font\-size:.*?\;'; throwns the error

[PHP] Regular expressions

2005-04-12 Thread jem777
Php docs are quite messy about what works with what function... This is my problem; I want to strip out spaces from my tags: $word = [ / quote ]; $word = eregi_replace([[[:blank:]]*quote[[:blank:]]*], [quote], $word); $word = eregi_replace([[[:blank:]]*\/[[:blank:]]*quote[[:blank:]]*], [/quote],

Re: [PHP] Regular expressions

2005-04-12 Thread Jason Wong
On Tuesday 12 April 2005 18:30, jem777 wrote: Php docs are quite messy about what works with what function... This is my problem; I want to strip out spaces from my tags: $word = [ / quote ]; $word = eregi_replace([[[:blank:]]*quote[[:blank:]]*], [quote], $word); $word =

Re: [PHP] Regular expressions

2005-04-12 Thread jem777
ok for this 2: $body = preg_replace('|\[\s*quote\s*\]|', '[quote]', $body); $body = preg_replace('|\[\s*/\s*quote\s*\]|', '[/quote]', $body); but have these next instructions the same result? $body = eregi_replace(\[ *quote *\], [quote], $body); $body = eregi_replace(\[ */ *quote *\], [/quote],

[PHP] Regular Expressions?

2005-04-08 Thread list_php_general
Windows 2000 Server IIS 5/Apache 1.3.33 MySQL 4.1.1 Smarty 2.6.9 PHP 5.0.3 Hi all, I am looking for help handling a form input to SQL. I believe the solution has to do with regular expressions. My big problem is that when a user submits data such as: Joe's Crabshack The ' apostrophe or can

RE: [PHP] Regular Expressions?

2005-04-08 Thread Chris W. Parker
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] on Friday, April 08, 2005 3:43 PM said: The ' apostrophe or can cause an early truncation of the data. My code thinks that the closing identifier is after the word Joe and the rest of the input is lost. Further, if the data does get by and it

RE: [PHP] Regular Expressions?

2005-04-08 Thread list_php_general
Ok that would solve my SQL statements from breaking but how about in the submitted form data at submit time? John [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] on Friday, April 08, 2005 3:43 PM said: The ' apostrophe or can cause an early truncation of the data. My code thinks that the

RE: [PHP] Regular Expressions?

2005-04-08 Thread Chris W. Parker
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] on Friday, April 08, 2005 4:08 PM said: Ok that would solve my SQL statements from breaking but how about in the submitted form data at submit time? Do you mean you're having this problem? input type=text name=.. value=She said Hi! / ? If so,

Re: [PHP] Regular Expressions?

2005-04-08 Thread dan
[EMAIL PROTECTED] wrote: Windows 2000 Server IIS 5/Apache 1.3.33 MySQL 4.1.1 Smarty 2.6.9 PHP 5.0.3 Hi all, I am looking for help handling a form input to SQL. I believe the solution has to do with regular expressions. My big problem is that when a user submits data such as: Joe's Crabshack The

Re: [PHP] Regular Expressions?

2005-04-08 Thread John Nichel
[EMAIL PROTECTED] wrote: snip Joe's Crabshack The ' apostrophe or can cause an early truncation of the data. My code thinks that the closing identifier is after the word Joe and the rest of the input is lost. Further, if the data does get by and it could possibly break a SQL statement. Am I

Re: [PHP] Regular Expressions?

2005-04-08 Thread Richard Lynch
On Fri, April 8, 2005 3:43 pm, [EMAIL PROTECTED] said: I am looking for help handling a form input to SQL. I believe the solution has to do with regular expressions. My big problem is that when a user submits data such as: Joe's Crabshack The ' apostrophe or can cause an early truncation

[PHP] Regular expressions stopped working

2005-01-29 Thread Kristian Hellquist
Hi! I had a script for parsing text into html, similar to phpBB. Everything has been working fine until now. Some of my 'pseudotags' like [b] are still recognized (parsed into b) but some more advanced pattern matching is not. I haven't changed the code, but the php-version on the server has

Re: [PHP] regular expressions ?

2005-01-28 Thread Robin Vickery
On Thu, 27 Jan 2005 11:36:39 -0800, Rick Fletcher [EMAIL PROTECTED] wrote: /^(1?[1-9]|[12]0)$/ works too. The first part covers 1-9, 11-19; the second part gets you 10 and 20. Plus, it's ever so slightly shorter! And isnt' that what's most important? :P absolutely, and you managed it

[PHP] regular expressions ?

2005-01-27 Thread Zouari Fourat
Hello, I need to verify if $x is between 1 and 20 and i need to do that with regular expressions ? anyone can help me outta there ? thanks a lot -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] regular expressions ?

2005-01-27 Thread Marek Kilimajer
Zouari Fourat wrote: Hello, I need to verify if $x is between 1 and 20 and i need to do that with regular expressions ? anyone can help me outta there ? thanks a lot http://www.php.net/operators.comparison -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

RE: [PHP] regular expressions ?

2005-01-27 Thread Jay Blanchard
[snip] I need to verify if $x is between 1 and 20 and i need to do that with regular expressions ? anyone can help me outta there ? [/snip] Why regex? if((1 $x) ($x 20)){ it's true } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] regular expressions ?

2005-01-27 Thread Leif Gregory
Hello Zouari, Thursday, January 27, 2005, 7:33:04 AM, you wrote: Z I need to verify if $x is between 1 and 20 and i need to do that Z with regular expressions ? If you *need* to do it with regexp, try this: if (preg_match(/[2-19]/,$x)) echo It is!; If 1 and 20 are

Re: [PHP] regular expressions ?

2005-01-27 Thread Marek Kilimajer
Zouari Fourat wrote: here's the problem : my user MUST input only digits between 1 and 20 doing a is_numeric and some comparaison can be bypassed by inputing : .5 or 0.5 or 5.1 or 0.3 or .01 ... ... so i thought that the smartest way is to use regex if( $i = 1 $i = 20 $i == (int)$i) ... -- PHP

Re: [PHP] regular expressions ?

2005-01-27 Thread Zouari Fourat
if (preg_match(/[2-19]/,$x)) echo It is!; doesnt work ! this is working fine : if (eregi(^-?([1-3])+$,$x) echo x is 1 or 2 or 3; On Thu, 27 Jan 2005 08:42:19 -0700, Leif Gregory [EMAIL PROTECTED] wrote: Hello Zouari, Thursday, January 27, 2005, 7:33:04 AM, you wrote: Z I need to

Re: [PHP] regular expressions ?

2005-01-27 Thread Zouari Fourat
this is working fine : if (eregi(^-?([1-3])+$,$x) echo x is 1 or 2 or 3; i forgot to say that doesnt work with 1-20 :( how to do it ? On Thu, 27 Jan 2005 16:53:55 +0100, Zouari Fourat [EMAIL PROTECTED] wrote: if (preg_match(/[2-19]/,$x)) echo It is!; doesnt work ! this is working

Re: [PHP] regular expressions ?

2005-01-27 Thread Zouari Fourat
to Marek Kilimajer : $i='5.'; if (($i=1) ($i=20) ($i==(int)$i)) echo 'yes'; // yes :'( On Thu, 27 Jan 2005 16:52:20 +0100, Marek Kilimajer [EMAIL PROTECTED] wrote: Zouari Fourat wrote: here's the problem : my user MUST input only digits between 1 and 20

  1   2   3   >