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

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

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

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

[PHP] Regex error

2007-03-14 Thread jekillen
Hello; The following regex: ereg(member value='[a-zA-Z ]{1,25}' uspace='([a-z0-9-\.\/]{2,11})' id='$m[1]', $groups, $m1); is causing the following error: Warning: ereg() [function.ereg]: REG_ERANGE in path info_proc.php on line 81 Can someone tell me what this means? What I am trying to

Re: [PHP] Regex error

2007-03-14 Thread Myron Turner
jekillen wrote: Hello; The following regex: ereg(member value='[a-zA-Z ]{1,25}' uspace='([a-z0-9-\.\/]{2,11})' id='$m[1]', $groups, $m1); is causing the following error: Warning: ereg() [function.ereg]: REG_ERANGE in path info_proc.php on line 81 Can someone tell me what this means?

Re: [PHP] Regex error

2007-03-14 Thread Richard Lynch
On Wed, March 14, 2007 7:56 pm, jekillen wrote: Hello; The following regex: ereg(member value='[a-zA-Z ]{1,25}' uspace='([a-z0-9-\.\/]{2,11})' id='$m[1]', $groups, $m1); is causing the following error: Warning: ereg() [function.ereg]: REG_ERANGE in path info_proc.php on line 81 Can

Re: [PHP] Regex Mixtake

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

[PHP] Regex Mixtake

2007-02-03 Thread Manolet Gmail
Hi, i have a problem using regex, i want to get all the text between so i try this... $subject = 'menu Archer?,-,Chief?,L_Menu2,Big Mouth?,L_Menu3;'; if (ereg('([^]*)', $subject, $regs)) { print_r($regs); } but just return me: Array ( [0] = Archer? [1] = Archer? ) not return

Re: [PHP] Regex Mixtake

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

Re: [PHP] Regex Mixtake

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

Re: [PHP] Regex Mixtake

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

Re: [PHP] Regex Mixtake

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

Re: [PHP] Regex Mixtake

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

Re: [PHP] Regex Mixtake

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

Re: [PHP] regex

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

[PHP] regex

2006-10-19 Thread Bagus Nugroho
Hi All, If we have variable like : $var1 = 'abcde 12'; $var2 = 'abcdefghi 34'; $var3 = 'abc 20 def'; Then we want output like : $var1 = 'abcde'; $var2 = 'abcdefghi'; $var3 = 'abc def'; How regex can help us?. Thanks in advance. bgs -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] regex

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

Re: [PHP] regex

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

Re: [PHP] regex

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

Re: [PHP] regex

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

Re: [PHP] regex

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

[PHP] Regex

2006-08-21 Thread Nadim Attari
Hello, I have some text in a table... the text contains hyperlinks (but not html coded, i.e. plain Some text...http://www.something.com;) When i retrieve these texts from the table, i want the hyperlinks to become clickable, i.e. a href etc added automatically. Some text...a

Re: [PHP] Regex

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

[PHP] regex brain-toot

2006-06-19 Thread Jay Blanchard
I have a field that contains a value in parenthesis', but also contains other text, for instance; (it is a legacy app that I am working with, and by legacy I am saying pre-1980) Upper voltage (124.1) I know that \([0-9]*\) will get me (124.1), but I am totally forgetting how to get 124.1 without

Re: [PHP] regex brain-toot

2006-06-19 Thread John Nichel
Jay Blanchard wrote: I have a field that contains a value in parenthesis', but also contains other text, for instance; (it is a legacy app that I am working with, and by legacy I am saying pre-1980) Upper voltage (124.1) I know that \([0-9]*\) will get me (124.1), but I am totally forgetting

Re: [PHP] regex brain-toot

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

RE: [PHP] regex brain-toot

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

RE: [PHP] regex brain-toot

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

Re: [PHP] regex brain-toot

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

RE: [PHP] regex brain-toot

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

Re: [PHP] regex brain-toot

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

RE: [PHP] regex brain-toot

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

[PHP] regex problem

2006-06-01 Thread Merlin
Hi there, I do work on following regex: ^(.*)_a[0-9](.*).htm$ This should be valid for test_a9393.htm, but not for 9393.htm as ther is no leading _a infront of the number. Unfortunatelly this also works for the 9393.htm file. Can somebody give me a hint why the regex also is true for text

Re: [PHP] regex problem

2006-06-01 Thread Dave Goodchild
On 01/06/06, Merlin [EMAIL PROTECTED] wrote: Hi there, I do work on following regex: ^(.*)_a[0-9](.*).htm$ This should be valid for test_a9393.htm, but not for 9393.htm as ther is no leading _a infront of the number. Unfortunatelly this also works for the 9393.htm file. Can somebody give me

Re: [PHP] regex problem

2006-06-01 Thread Merlin
Dave Goodchild schrieb: On 01/06/06, Merlin [EMAIL PROTECTED] wrote: Hi there, I do work on following regex: ^(.*)_a[0-9](.*).htm$ This should be valid for test_a9393.htm, but not for 9393.htm as ther is no leading _a infront of the number. Unfortunatelly this also works for the 9393.htm

RE: [PHP] regex problem

2006-06-01 Thread Dan Parry
[snip] Hi there, I do work on following regex: ^(.*)_a[0-9](.*).htm$ This should be valid for test_a9393.htm, but not for 9393.htm as ther is no leading _a infront of the number. Unfortunatelly this also works for the 9393.htm file. Can somebody give me a hint why the regex also is true for

Re: [PHP] regex problem

2006-06-01 Thread Robin Vickery
On 01/06/06, Merlin [EMAIL PROTECTED] wrote: Hi there, I do work on following regex: ^(.*)_a[0-9](.*).htm$ This should be valid for test_a9393.htm, but not for 9393.htm as ther is no leading _a infront of the number. Unfortunatelly this also works for the 9393.htm file. Can somebody give me a

Re: [PHP] regex problem

2006-06-01 Thread Merlin
Robin Vickery schrieb: On 01/06/06, Merlin [EMAIL PROTECTED] wrote: Hi there, I do work on following regex: ^(.*)_a[0-9](.*).htm$ This should be valid for test_a9393.htm, but not for 9393.htm as ther is no leading _a infront of the number. Unfortunatelly this also works for the 9393.htm

Re: [PHP] regex problem

2006-06-01 Thread John Nichel
Merlin wrote: Hi there, I do work on following regex: ^(.*)_a[0-9](.*).htm$ This should be valid for test_a9393.htm, but not for 9393.htm as ther is no leading _a infront of the number. Unfortunatelly this also works for the 9393.htm file. Can somebody give me a hint why the regex also is

Re: [PHP] regex problem

2006-06-01 Thread Richard Lynch
On Thu, June 1, 2006 4:56 am, Merlin wrote: ^(.*)_a[0-9](.*).htm$ Don't know what it will help, but you need \\.htm in PHP to get \.htm in PCRE to escape the . in the extension. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe,

Re: [PHP] Regex Help for URL's [ANSWER]

2006-05-17 Thread Edward Vermillion
On May 16, 2006, at 7:53 PM, Chrome wrote: -Original Message- From: Robert Samuel White [mailto:[EMAIL PROTECTED] Sent: 17 May 2006 01:42 To: php-general@lists.php.net Subject: RE: [PHP] Regex Help for URL's [ANSWER] That's what I was doing. I was parsing A:HREF, IMG:SRC, etc

Re: [PHP] Regex Help for URL's

2006-05-17 Thread Kevin Waterson
This one time, at band camp, Robert Samuel White [EMAIL PROTECTED] wrote: Don't be rude. I've already don't all of that. Nothing came up. I've been programming for 20 years (since I was 11 years old) so I'm not a slacker when it comes to learning new things, however, I have always found

[PHP] Regex Help for URL's

2006-05-16 Thread Robert Samuel White
Can someone help me modify the following code? It was designed to search for all instances of [LEVEL#]...[/LEVEL#] I need a preg_match_all that will search for all of instances of an URL. It should be sophisticated enough to find something as complicated as this:

Re: [PHP] Regex Help for URL's

2006-05-16 Thread Jochem Maas
Robert Samuel White wrote: Can someone help me modify the following code? It was designed to search for all instances of [LEVEL#]...[/LEVEL#] I need a preg_match_all that will search for all of instances of an URL. It should be sophisticated enough to find something as complicated as this:

RE: [PHP] Regex Help for URL's

2006-05-16 Thread Robert Samuel White
: [PHP] Regex Help for URL's Robert Samuel White wrote: Can someone help me modify the following code? It was designed to search for all instances of [LEVEL#]...[/LEVEL#] I need a preg_match_all that will search for all of instances of an URL. It should be sophisticated enough to find

RE: [PHP] Regex Help for URL's

2006-05-16 Thread Robert Cummings
On Tue, 2006-05-16 at 16:31, Robert Samuel White wrote: Don't be rude. I've already don't all of that. Nothing came up. I've been programming for 20 years (since I was 11 years old) so I'm not a slacker when it comes to learning new things, however, I have always found regular expressions

Re: [PHP] Regex Help for URL's

2006-05-16 Thread John Nichel
it makes the email hard to read. Why is top posting bad? -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 16, 2006 4:28 PM To: Robert Samuel White Cc: php-general@lists.php.net Subject: Re: [PHP] Regex Help for URL's Robert Samuel White wrote: Can

RE: [PHP] Regex Help for URL's

2006-05-16 Thread Robert Samuel White
I am trying to get all of the urls in a web document, so that I can append information to the urls when needed (when the url points to a domain that resides on my server). It allows me to pass session information across the domains of my network. Currently, I use a class I wrote to handle this,

Re: [PHP] Regex Help for URL's

2006-05-16 Thread Jochem Maas
: Re: [PHP] Regex Help for URL's Robert Samuel White wrote: Can someone help me modify the following code? It was designed to search for all instances of [LEVEL#]...[/LEVEL#] I need a preg_match_all that will search for all of instances of an URL. It should be sophisticated enough to find

RE: [PHP] Regex Help for URL's

2006-05-16 Thread Chrome
-Original Message- From: Robert Samuel White [mailto:[EMAIL PROTECTED] Sent: 16 May 2006 21:32 To: php-general@lists.php.net Subject: RE: [PHP] Regex Help for URL's Don't be rude. I've already don't all of that. Nothing came up. I've been programming for 20 years (since I

RE: [PHP] Regex Help for URL's [ANSWER]

2006-05-16 Thread Robert Samuel White
In case any one is looking for a solution to a similar problem as me, here is the answer. I used the code from my original post as my guiding light, and with some experimentation, I figured it out. To get any URL, regardless of where it is located, use this: preg_match_all(#\'http://(.*)\'#U,

RE: [PHP] Regex Help for URL's [ANSWER]

2006-05-16 Thread Robert Cummings
On Tue, 2006-05-16 at 18:49, Robert Samuel White wrote: In case any one is looking for a solution to a similar problem as me, here is the answer. I used the code from my original post as my guiding light, and with some experimentation, I figured it out. To get any URL, regardless of where

RE: [PHP] Regex Help for URL's [ANSWER]

2006-05-16 Thread Richard Lynch
On Tue, May 16, 2006 6:21 pm, Robert Cummings wrote: On Tue, 2006-05-16 at 18:49, Robert Samuel White wrote: In case any one is looking for a solution to a similar problem as me, here preg_match_all(#(\|')http://(.*)(\|')#U, $content, $matches); And it's missing the original requirement of

RE: [PHP] Regex Help for URL's [ANSWER]

2006-05-16 Thread Robert Samuel White
All pages used by my content management system must be in a valid format. Old-school style pages are never created so the solution I have come up with is perfect for my needs. Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] Regex Help for URL's [ANSWER]

2006-05-16 Thread Chrome
-Original Message- From: Robert Samuel White [mailto:[EMAIL PROTECTED] Sent: 17 May 2006 01:16 To: php-general@lists.php.net Subject: RE: [PHP] Regex Help for URL's [ANSWER] All pages used by my content management system must be in a valid format. Old-school style pages

Re: [PHP] Regex Help for URL's

2006-05-16 Thread Richard Lynch
On Tue, May 16, 2006 4:22 pm, Jochem Maas wrote: personally I would assume anyone who had been programming for 20 yrs would have a reasonable understanding of regexps. Nope. :-) I got WAY past 20 year mark before I even began to pretend to understand the minimal amount of regex I can do now.

RE: [PHP] Regex Help for URL's [ANSWER]

2006-05-16 Thread Robert Samuel White
, then they'll code their pages to make use of this limitation. -Original Message- From: Chrome [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 16, 2006 8:24 PM To: 'Robert Samuel White'; php-general@lists.php.net Subject: RE: [PHP] Regex Help for URL's [ANSWER] -Original Message

RE: [PHP] Regex Help for URL's [ANSWER]

2006-05-16 Thread Chrome
-Original Message- From: Robert Samuel White [mailto:[EMAIL PROTECTED] Sent: 17 May 2006 01:28 To: php-general@lists.php.net Subject: RE: [PHP] Regex Help for URL's [ANSWER] In my opinion, it is the most reasonable solution. I have looked all over the web for something else

RE: [PHP] Regex Help for URL's [ANSWER]

2006-05-16 Thread Robert Samuel White
If we are talking clickable links, why not focus on the a construct itself? Otherwise URLs are just part of the page's textual content... Very difficult to parse that Disseminating an a tag isn't brain-meltingly difficult with a regex if you put your mind to it... With or without quotes, be

RE: [PHP] Regex Help for URL's [ANSWER]

2006-05-16 Thread Chrome
-Original Message- From: Robert Samuel White [mailto:[EMAIL PROTECTED] Sent: 17 May 2006 01:42 To: php-general@lists.php.net Subject: RE: [PHP] Regex Help for URL's [ANSWER] If we are talking clickable links, why not focus on the a construct itself? Otherwise URLs are just

Re: [PHP] REGEX query

2006-02-09 Thread Tom Rogers
Hi, Saturday, February 4, 2006, 2:53:32 PM, you wrote: p Hi, p I'm still trying to get to grips with REGEX and have hit a hurdle with p the following: p I have this bit of text: p (\(EX\) RV-6 ) p I want to remove the '\(EX\)' part of it p so leaving just: ( RV-6 ) p Any suggestions would be

Re: [PHP] REGEX query

2006-02-08 Thread Burhan
phplists wrote: Hi, I'm still trying to get to grips with REGEX and have hit a hurdle with the following: I have this bit of text: (\(EX\) RV-6 ) I want to remove the '\(EX\)' part of it so leaving just: ( RV-6 ) $text = '(\(EX\) RV-6 )'; $bits = explode(' ',$text); $leaving = '(

Re: [PHP] REGEX query

2006-02-08 Thread Kim Christensen
I have this bit of text: (\(EX\) RV-6 ) I want to remove the '\(EX\)' part of it so leaving just: ( RV-6 ) $text = '(\(EX\) RV-6 )'; $str = str_replace('\(EX\)','',$text); As Burhan put it, regex is not always the solution to your problem - in most cases, using regex for this kind of

Re: [PHP] REGEX query

2006-02-08 Thread phplists
Thanks for that...and yes that would do very nicely. Unfortunately, for what I'm trying to do, it is of little use. I probably should have mentioned that the bit of text I used is actually just part of a much bigger bit of text so exploding on a space would cause havoc with the rest of it.

Re: [PHP] REGEX query

2006-02-08 Thread phplists
Hi Murray, The length of text is quite long..it is in fact a 150+ page PDF file, which as it's using an earlier version of PDF I can 'translate' into a format that I can extract data from..it's just this one bit of text that I'm stuck on. Yes it does appear multiple times, but the pattern is

Re: [PHP] REGEX query

2006-02-08 Thread Kim Christensen
Alexis, Unfortunately, for what I'm trying to do, it is of little use. I probably should have mentioned that the bit of text I used is actually just part of a much bigger bit of text so exploding on a space would cause havoc with the rest of it. Hence the REGEX question. $text =

Re: [PHP] REGEX query

2006-02-08 Thread phplists
I have this bit of text: (\(EX\) RV-6 ) I want to remove the '\(EX\)' part of it so leaving just: ( RV-6 ) $text = '(\(EX\) RV-6 )'; $str = str_replace('\(EX\)','',$text); As Burhan put it, regex is not always the solution to your problem - in most cases, using regex for this kind

Re: [PHP] REGEX query

2006-02-04 Thread phplists
Thanks for the options David. I think I'll go for the last option as I'm determined to get to grips with REGEX, and your first choice of REGEX won't work for me as the 'RV-6' bit can be too variable with what it contains, whereas the \(EX\) bit IS more constant...it's only the EX bit that

[PHP] REGEX query

2006-02-03 Thread phplists
Hi, I'm still trying to get to grips with REGEX and have hit a hurdle with the following: I have this bit of text: (\(EX\) RV-6 ) I want to remove the '\(EX\)' part of it so leaving just: ( RV-6 ) Any suggestions would be most appreciated. Thanks Alexis -- PHP General Mailing List

Re: [PHP] REGEX query

2006-02-03 Thread David Tulloh
I assume that the text inside can change around a fair bit. If the string is of a fixed with or simple format you can just use substr() and friends, it's simpler and faster. That said, there is really two approaches that I can see with this string. You can match on the spaces to extract the

Re: [PHP] Regex help

2006-01-14 Thread Curt Zirzow
On Fri, Jan 13, 2006 at 08:25:57AM -0500, Mike Smith wrote: I'm trying to save myself some time by extracting certain variables from a string: 102-90 E 42 X 42 X 70 3/8 I've been testing with: http://www.quanetic.com/regex.php and have been somewhat successful. Using this pattern:

[PHP] Regex help

2006-01-13 Thread Mike Smith
I'm trying to save myself some time by extracting certain variables from a string: 102-90 E 42 X 42 X 70 3/8 I've been testing with: http://www.quanetic.com/regex.php and have been somewhat successful. Using this pattern: /[0-9]{2,}( X| x|x )/ I have: 102-90 E [!MATCH!] [!MATCH!] 70 3/8

RE: [PHP] Regex help

2006-01-13 Thread Albert
Mike Smith wrote: I'm trying to save myself some time by extracting certain variables from a string: 102-90 E 42 X 42 X 70 3/8 If this string is always in this format xxx E panel X width X height then you could try something like: // Very much untested $unit = '102-90 E 42 X 42 X 70 3/8';

Re: [PHP] Regex help

2006-01-13 Thread Eric Martel
This should do the trick: /(\d+) ?X ?(\d+) ?X ?(\d+ [\d\/]+)/i (at least it would in Perl) Le 13 Janvier 2006 08:25, Mike Smith a écrit : I'm trying to save myself some time by extracting certain variables from a string: 102-90 E 42 X 42 X 70 3/8 I've been testing with:

Re: [PHP] Regex help

2006-01-13 Thread Mike Smith
Eric, thanks for replying. I couldn't quite get that to work. Albert, I'm currently working with what you suggested, though the unit names are not that consistent: $vals = preg_split(' ?X? ',$unit[1]); echo strong.$unit[1]./strongbr /\n; echo Panel: .$vals[0].br /Width: .$vals[1].br /Height:

[PHP] RegEx drop everything after last pattern

2005-12-23 Thread John Nichel
Okay, maybe it's just the fact that I'm concentration on getting out of here for the holidays more than I am on my work, but I'm pulling my hair out. Say I have a string - Now, is the time; for all good men! to come to the aide? of their What I want to do is drop everything after (and

Re: [PHP] RegEx drop everything after last pattern

2005-12-23 Thread John Nichel
John Nichel wrote: Okay, maybe it's just the fact that I'm concentration on getting out of here for the holidays more than I am on my work, but I'm pulling my hair out. Say I have a string - Now, is the time; for all good men! to come to the aide? of their What I want to do is drop

Re: [PHP] Regex to wrap a href= tag around a p tag

2005-12-02 Thread Kristen G. Thorson
Shaun wrote: Hi M, Thanks for your help, the code works fine except if there is a line break in the html, for example this works ptest/p But this doesnt ptest /p Any ideas? See the last user contributed note from *csaba at alum dot mit dot edu *at

Re: [PHP] Regex to wrap a href= tag around a p tag

2005-12-01 Thread M
The second parameter to preg_replace is the replacement string (with optional backreferences), not another patern. Use '/p\(.*)(?=\/p)/' for patern, 'a href=edit_paragraphtext=$1p$1' for replacement string, however, this does not urlencode the text parameter. You can use preg_replace_callback

[PHP] Regex for balanced brackets?

2005-11-21 Thread Jeffrey Sambells
I came across this method of matching brackets with regex in .NET http://puzzleware.net/blogs/archive/2005/08/13/22.aspx but I am wondering if it is possible to do the same in PHP? I've tried it a bit but I can't seem to get it to work properly. I'm just wondering if I am doing something

Re: [PHP] Regex for balanced brackets?

2005-11-21 Thread David Tulloh
I think you are doing it wrong, though reading other people's regex easily is a skill I lack. It is however very possible. The php manual has a section on recursive regex where it explains how to solve the bracket problem.

[PHP] Regex help

2005-11-18 Thread Chris Boget
Why isn't this regular expression ^[A-Za-z0-9\.]+\s*[A-Za-z0-9\.]*$ allowing for this value: 'Co. Dublin' (w/o the single quotes) ? It's failing the regular expression match... thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Regex help

2005-11-18 Thread Robert Cummings
On Fri, 2005-11-18 at 10:55, Chris Boget wrote: Why isn't this regular expression ^[A-Za-z0-9\.]+\s*[A-Za-z0-9\.]*$ allowing for this value: 'Co. Dublin' (w/o the single quotes) ? It's failing the regular expression match... Do you have that expression embedded in single or double

Re: [PHP] Regex help

2005-11-18 Thread David Grant
Chris, if (preg_match(/^[A-Za-z0-9\.]+\s*[A-Za-z0-9\.]*$/, Co. Dublin)) echo TRUE; else echo FALSE; prints TRUE for me. Cheers, David Grant Chris Boget wrote: Why isn't this regular expression ^[A-Za-z0-9\.]+\s*[A-Za-z0-9\.]*$ allowing for this value: 'Co. Dublin' (w/o the

Re: [PHP] Regex for Amateur Radio Callsigns

2005-11-17 Thread Greg Beaver
Leonard Burton wrote: HI, Tuesday, November 15, 2005, 8:39:19 PM, you wrote: Here are how they look W1W W1AW WA1W AD4HZ N9URK WB6NOA 4N1UBG Let's do it this way... What are the rules for a valid callsign? Basicly, you see an example of each different type of callsign. Other than the

RE: [PHP] Regex for Amateur Radio Callsigns

2005-11-16 Thread Ford, Mike
-Original Message- From: Leonard Burton [mailto:[EMAIL PROTECTED] Sent: 16 November 2005 03:39 To: php-general@lists.php.net Basically here is the regex I used (I am not the best with regexes): $pattern = /^[0-9]?[A-Z]{1,2}[0-9][A-Z]{1,3}/; Here are how they look W1W W1AW

Re: [PHP] Regex for Amateur Radio Callsigns

2005-11-16 Thread Stephen Calnan
The only problem with this is that it would take 444 which is not a valid call. Wikipedia defines a HAM call sign here: http://en.wikipedia.org/wiki/Call_sign#Amateur_radio A regex based upon this definition might be: /\b(([A-Z]{1,2})|([A-Z][0-9]))[0-9][A-Z]{1,3}\b/ I tested this out a

Re[2]: [PHP] Regex for Amateur Radio Callsigns

2005-11-16 Thread Leif Gregory
Hello Leonard, Tuesday, November 15, 2005, 8:39:19 PM, you wrote: Here are how they look W1W W1AW WA1W AD4HZ N9URK WB6NOA 4N1UBG Let's do it this way... What are the rules for a valid callsign? i.e. - If it's only three characters, it must start with a letter. - All callsigns must have

Re: Re[2]: [PHP] Regex for Amateur Radio Callsigns

2005-11-16 Thread Leonard Burton
HI, Tuesday, November 15, 2005, 8:39:19 PM, you wrote: Here are how they look W1W W1AW WA1W AD4HZ N9URK WB6NOA 4N1UBG Let's do it this way... What are the rules for a valid callsign? Basicly, you see an example of each different type of callsign. Other than the patterns you

[PHP] Regex for Amateur Radio Callsigns

2005-11-15 Thread Leonard Burton
Hi All, Does anyone know of a regex to work for Amateur Radio Callsigns that will work with any from across the world? Thanks and 73, -- Leonard Burton, N9URK [EMAIL PROTECTED] The prolonged evacuation would have dramatically affected the survivability of the occupants. -- PHP General

Re: [PHP] Regex for Amateur Radio Callsigns

2005-11-15 Thread Curt Zirzow
On Tue, Nov 15, 2005 at 03:47:21PM -0500, Leonard Burton wrote: Does anyone know of a regex to work for Amateur Radio Callsigns that will work with any from across the world? What does a amateur radio callsign look like? And in what context are you trying to parse this callsign? Curt. --

Re: [PHP] Regex for Amateur Radio Callsigns

2005-11-15 Thread Leonard Burton
HI Curt, Thanks for the reply, What does a amateur radio callsign look like? And in what context are you trying to parse this callsign? Basically here is the regex I used (I am not the best with regexes): $pattern = /^[0-9]?[A-Z]{1,2}[0-9][A-Z]{1,3}/; Here are how they look W1W W1AW WA1W

Re: [PHP] Regex for Amateur Radio Callsigns

2005-11-15 Thread Curt Zirzow
On Tue, Nov 15, 2005 at 10:39:19PM -0500, Leonard Burton wrote: HI Curt, Thanks for the reply, What does a amateur radio callsign look like? And in what context are you trying to parse this callsign? Basically here is the regex I used (I am not the best with regexes): $pattern =

Re: [PHP] Regex for Amateur Radio Callsigns

2005-11-15 Thread Leonard Burton
HI Curt, W1W W1AW WA1W AD4HZ N9URK WB6NOA 4N1UBG Ok, so i can conclude so far we have alpha numeric chars minimum of 3 chars up to 6, this would make a regex: /[A-Z0-9]{3,6}/ The only problem with this is that it would take 444 which is not a valid call. $pattern = /^;

Re: [PHP] Regex for Amateur Radio Callsigns

2005-11-15 Thread Curt Zirzow
On Wed, Nov 16, 2005 at 12:25:22AM -0500, Leonard Burton wrote: HI Curt, W1W W1AW WA1W AD4HZ N9URK WB6NOA 4N1UBG Ok, so i can conclude so far we have alpha numeric chars minimum of 3 chars up to 6, this would make a regex: /[A-Z0-9]{3,6}/ The only problem with this

Re: [PHP] regex and global vars problem

2005-10-28 Thread Robin Vickery
On 10/28/05, Tom Rogers [EMAIL PROTECTED] wrote: I would do it with a small class like this: ?php class mac{ var $mac=''; var $is_valid = false; function mac($mac){ $mac = preg_replace('/[^0-9A-F]/','',strtoupper($mac)); if($this-is_valid =

Re[2]: [PHP] regex and global vars problem

2005-10-28 Thread Tom Rogers
Hi, Friday, October 28, 2005, 7:20:58 PM, you wrote: RV On 10/28/05, Tom Rogers [EMAIL PROTECTED] wrote: I would do it with a small class like this: RV $mactest = new mac(there are a few gotchas for anyone using this); print $mactest-is_valid ? valid\n : invalid\n; RV // valid RV -- RV PHP

Re: [PHP] regex and global vars problem

2005-10-27 Thread Richard Heyes
Jochem Maas wrote: gonna jump on your thread there Jasper, I would like to comment on your function and ask you a question: which is 'better' (for what), preg_*() or ereg[i]*()? preg_*, for anything. They're faster, and more versatile. -- Richard Heyes http://www.phpguru.org -- PHP General

Re: [PHP] regex and global vars problem

2005-10-27 Thread Jochem Maas
Richard Heyes wrote: Jochem Maas wrote: gonna jump on your thread there Jasper, I would like to comment on your function and ask you a question: which is 'better' (for what), preg_*() or ereg[i]*()? preg_*, for anything. They're faster, and more versatile. cool cheers. I guess your

Re: [PHP] regex and global vars problem

2005-10-27 Thread Richard Heyes
Jochem Maas wrote: Richard Heyes wrote: Jochem Maas wrote: gonna jump on your thread there Jasper, I would like to comment on your function and ask you a question: which is 'better' (for what), preg_*() or ereg[i]*()? preg_*, for anything. They're faster, and more versatile. cool

Re: [PHP] regex and global vars problem

2005-10-27 Thread Jasper Bryant-Greene
On Thu, 2005-10-27 at 00:00 +0200, Jochem Maas wrote: gonna jump on your thread there Jasper, I would like to comment on your function and ask you a question: which is 'better' (for what), preg_*() or ereg[i]*()? I prefer preg_*(), but I used eregi() because I couldn't be bothered figuring

<    1   2   3   4   5   6   7   8   >