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 ho

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

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

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

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 fo

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

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 giv

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 fou

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,

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 cons

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 construct > itself? Otherwise URLs are just part of the page's textual content... Very > difficult to parse that > Disseminating an tag isn't brain-meltingly difficult with a regex if > you put your mind to it... With or without quotes,

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 ov

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

2006-05-16 Thread Robert Samuel White
in a page, 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 [ANS

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

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

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 whe

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

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

Re: [PHP] Regex Help for URL's

2006-05-16 Thread Jochem Maas
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 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 w

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

Re: [PHP] Regex Help for URL's

2006-05-16 Thread John Nichel
us to do it for. Simple enough, don't you think. Because 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

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

RE: [PHP] Regex Help for URL's

2006-05-16 Thread Robert Samuel White
ite Cc: php-general@lists.php.net Subject: 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

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

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 wo

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 re

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

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

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 = '( '.$bits[0

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 chan

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

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

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 "".$unit[1]."\n"; echo "Panel: ".$vals[0]."Width: ".$vals[1]."Height: ".$vals[2]."\n"; 202

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: http://www.q

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 E X X then you could try something like: // Very much untested $unit = '102-90 E 42 X 42 X 70 3/8'; $split1 = explo

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 everythin

Re: [PHP] Regex to wrap tag around a 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 test But this doesnt test Any ideas? See the last user contributed note from *csaba at alum dot mit dot edu *at http://us3.php.net/manual/en/reference.p

Re: [PHP] Regex to wrap tag around a tag

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

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. http://php.net/manual/en/reference.pcre.pattern.syntax.php#regexp.refer

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

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

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 pa

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

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 >

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

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

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): > > $p

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 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 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: > > class mac{ > var $mac=''; > var $is_valid = false; > function mac($mac){ > $mac = preg_replace('/[^0-9A-F]/','',strtoupper($mac)); > if($this->is_valid = > preg_match('/^(\w{2})(\w

Re: [PHP] regex and global vars problem

2005-10-27 Thread Tom Rogers
Hi, Thursday, October 27, 2005, 3:15:30 AM, you wrote: JG> I am having a problem with a couple of function I have written to check JG> for a type of string, attempt to fix it and pass it back to the main JG> function. Any help is appreciated. I would do it with a small class like this: is_valid

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 figurin

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

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 you

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 Gene

Re: [PHP] regex and global vars problem

2005-10-26 Thread Jochem Maas
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]*()? Jasper Bryant-Greene wrote: On Wed, 2005-10-26 at 12:24 -0600, Jason Gerfen wrote: The code I just showed you is supposed to do the fol

Re: [PHP] regex and global vars problem

2005-10-26 Thread Jasper Bryant-Greene
On Wed, 2005-10-26 at 12:24 -0600, Jason Gerfen wrote: > The code I just showed you is supposed to do the following, the > chk_mac() returns a true or false on the vars $mac1, $mac2 and $mac3. > $mac3 is the only var that should not be thrown into the fix_mac() > function which is working corre

Re: [PHP] regex and global vars problem

2005-10-26 Thread Jason Gerfen
The code I just showed you is supposed to do the following, the chk_mac() returns a true or false on the vars $mac1, $mac2 and $mac3. $mac3 is the only var that should not be thrown into the fix_mac() function which is working correctly. The problem is when $mac1 and $mac2 get put into the fi

Re: [PHP] regex and global vars problem

2005-10-26 Thread Jasper Bryant-Greene
On Wed, 2005-10-26 at 12:07 -0600, Jason Gerfen wrote: > Um I did actually, but I will re-interate the problem with more detail. > > the vars $mac1, $mac2, & $mac3 are to get passed to the chk_mac() > function which determines if it is a valid hex representation of a h/w > address, if it does no

Re: [PHP] regex and global vars problem

2005-10-26 Thread Jason Gerfen
Um I did actually, but I will re-interate the problem with more detail. the vars $mac1, $mac2, & $mac3 are to get passed to the chk_mac() function which determines if it is a valid hex representation of a h/w address, if it does not meet the criteria of having a ":" separating every two charac

Re: [PHP] regex and global vars problem

2005-10-26 Thread Jasper Bryant-Greene
On Wed, 2005-10-26 at 11:15 -0600, Jason Gerfen wrote: > I am having a problem with a couple of function I have written to check > for a type of string, attempt to fix it and pass it back to the main > function. Any help is appreciated. [snip] Would you mind telling us what the problem was? --

Re: [PHP] RegEx - Is this right?

2005-10-15 Thread Al Hafoudh
yes, it is equal, but i'd rather use file() function Gustav Wiberg wrote: Hi there! I want to get conents of a file and split into a array... $s = file_get_contents($fileName); $splitS = preg_split("/\n/",$s); Is this equal to using $splitS = file($fileName) ? /G http://www.varupirat

RE: [PHP] Regex Help

2005-09-28 Thread Pablo Gosse
Greetings folks. Thanks Murray and Philip for the quick responses. Adding the /s modifier worked perfectly. Cheers, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] Regex Help

2005-09-28 Thread Murray @ PlanetThoughtful
> Hi, folks. I'm having trouble with a simple regex. I'm sure it's just > something small that I'm missing but nothing I'm trying is working. > > In an HTML file I have comments like this: > > > various html crap here > > > Here's the regex I'm using: > > /(.*?)/ > > And then the call to

Re: [PHP] Regex Help

2005-09-28 Thread Philip Hallstrom
Hi, folks. I'm having trouble with a simple regex. I'm sure it's just something small that I'm missing but nothing I'm trying is working. In an HTML file I have comments like this: various html crap here Here's the regex I'm using: /(.*?)/ And then the call to preg_match_all(): preg_mat

Re: [PHP] REGEX Help Please

2005-09-19 Thread Stephen Leaf
On Monday 19 September 2005 09:03 am, Shaun wrote: > Hi, > > I am trying to implement a regular expression so that I have a number > between 0.00 and 1.00. the following works except I can go up to 1.99 > > $regexp = "/^[0-1]{1}.[0-9]{2}/"; > > Can anyone help here please? > > Thanks $regexp = "/^

Re: [PHP] REGEX Help Please

2005-09-19 Thread Robert Cummings
On Mon, 2005-09-19 at 10:11, John Nichel wrote: > Shaun wrote: > > Hi, > > > > I am trying to implement a regular expression so that I have a number > > between 0.00 and 1.00. the following works except I can go up to 1.99 > > > > $regexp = "/^[0-1]{1}.[0-9]{2}/"; > > > > Can anyone help here p

Re: [PHP] REGEX Help Please

2005-09-19 Thread John Nichel
Shaun wrote: Hi, I am trying to implement a regular expression so that I have a number between 0.00 and 1.00. the following works except I can go up to 1.99 $regexp = "/^[0-1]{1}.[0-9]{2}/"; Can anyone help here please? Thanks May have to go outside just a regex... if ( preg_match ( "/

Re: [PHP] regex

2005-09-08 Thread John Nichel
Merlin wrote: Hi there, I would like to create a regex which only executes if the client does not come from a specified IP adress. Any ideas how to place this into the Rewrite Rule regex?: I'm betting members of the Apache mailing list know. -- John C. Nichel ÜberGeek KegWorks.com 716.856.

Re: [PHP] regex

2005-09-08 Thread Jasper Bryant-Greene
Merlin wrote: I would like to create a regex which only executes if the client does not come from a specified IP adress. Any ideas how to place this into the Rewrite Rule regex?: What does this have to do with PHP? http://www.google.com/search?q=regular+expression The top four or five resul

RE: [PHP] REGEX for query

2005-08-11 Thread Michael Sims
Jay Blanchard wrote: > [snip] > Assuming unix, I'd do the following from the root of the application > to get a list > of files that contain queries: > > $ egrep "=[:space:]*\".*\b(SELECT|INSERT|UPDATE)\b" * -ril > ... > > Anyway, that's how I'd do it. Hope you got something out of this... > :) [/

RE: [PHP] REGEX for query

2005-08-11 Thread Jay Blanchard
[snip] > > That is a good start, now all I need to do is get the whole query(s) Get them from the mysql logs? [/snip] While that sounds like a good idea there are two things that hamper the effectiveness of this is a total solution; 1. The logs have many queries from other applications that *do

Re: [PHP] REGEX for query

2005-08-11 Thread Robin Vickery
On 8/11/05, Jay Blanchard <[EMAIL PROTECTED]> wrote: > > That is a good start, now all I need to do is get the whole query(s) Get them from the mysql logs? -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] REGEX for query

2005-08-11 Thread Jay Blanchard
[snip] Assuming unix, I'd do the following from the root of the application to get a list of files that contain queries: $ egrep "=[:space:]*\".*\b(SELECT|INSERT|UPDATE)\b" * -ril ... Anyway, that's how I'd do it. Hope you got something out of this... :) [/snip] That is a good start, now all I

RE: [PHP] REGEX for query

2005-08-10 Thread Michael Sims
Jay Blanchard wrote: > I have a rather interesting issue. I need to locate every query in > every PHP application we have for an integration project. I have > started doing some research, but I wanted throw this out there as a > little exercize because it is interesting. > > Several queries are wri

Re: [PHP] Regex help

2005-08-07 Thread Dotan Cohen
On 8/4/05, Lizet Pena de Sola <[EMAIL PROTECTED]> wrote: > Ok, it's not the regexp for detecting email addresses what I need, > that's widely published, thanks. I'm using ereg to match this regular > expression: > > (On)[\s\w\d\W\S\D\n]*(wr[i|o]te[s]?:) > > That will match phrases like > "On 8/3/

RE: [PHP] Regex help

2005-08-03 Thread Lizet Pena de Sola
a, Lizet -Original Message- From: Marcus Bointon [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 03, 2005 8:57 AM To: PHP General Subject: Re: [PHP] Regex help On 2 Aug 2005, at 15:12, Robin Vickery wrote: > I don't suppose this is the place for a rant about the futility of > ch

Re: [PHP] Regex help

2005-08-03 Thread Marcus Bointon
On 2 Aug 2005, at 15:12, Robin Vickery wrote: I don't suppose this is the place for a rant about the futility of checking email addresses with a regexp? Though I will agree with you to some extent, I've had quite a lot of success with this, which is pretty thorough: ^(?:[\w\!\#\$\%\&\'\*\+

Re: [PHP] Regex help

2005-08-02 Thread Dotan Cohen
On 8/2/05, Robin Vickery <[EMAIL PROTECTED]> wrote: > I don't suppose this is the place for a rant about the futility of > checking email addresses with a regexp? > > -robin Let Richard Lynch tell him. He's good at regex's, and it's HIS email address that never makes it through! Dotan Cohen ht

Re: [PHP] Regex help

2005-08-02 Thread Robin Vickery
On 8/2/05, Chris Boget <[EMAIL PROTECTED]> wrote: > I'm trying to validate an email address and for the life of me I > cannot figure out why the following regex is not working: > > $email = "[EMAIL PROTECTED]"; > $regex = > "^([a-zA-Z0-9_\.\-\']+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-

Re: [PHP] Regex help

2005-06-06 Thread Philip Hallstrom
I am currently creating a once off text parser for a rather large document that i need to strip out bits of information on certain lines. The line looks something like : "Adress line here, postcode, country Tel: +27 112233665 Fax: 221145221 Website: http://www.urlhere.com E-Mail: [EMAIL PROTECT

RE: [PHP] Regex question: replacing incidences of character when not enclosed within HTML tags? (somewhat solved)

2005-05-29 Thread Murray @ PlanetThoughtful
> So, thinking about it a little more, I decided what I was looking for was > a > regular expression that would allow me to replace any incidences of > hyphens > when not contained within tags (i.e., when not contained between "<" and > ">"). > > And this is where things have ground to a halt. Hi

RE: [PHP] Regex nightmares

2005-05-24 Thread Murray @ PlanetThoughtful
> [Course, when you *DO* need RegEx it's *more* than a bit of a headache. > More like a migraine :-)] One of these days I will truly master regular expressions. After that, enlightenment should be easy. Regards, Murray -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: ht

Re: [PHP] Regex nightmares

2005-05-24 Thread Richard Lynch
On Mon, May 23, 2005 8:43 am, W Luke said: > I really struggle with regex, and would appreciate some guidance. > Basically, I have a whole load of files (HTML) which are updated every > few minutes. I need to go through each line, looking for the word > CONFIRMED: (which is always in capitals, and

Re: [PHP] Regex nightmares

2005-05-23 Thread phpninja
W Luke wrote: > Hi, > > I really struggle with regex, and would appreciate some guidance. > Basically, I have a whole load of files (HTML) which are updated every > few minutes. I need to go through each line, looking for the word > CONFIRMED: (which is always in capitals, and always super

Re: [PHP] Regex nightmares

2005-05-23 Thread Philip Hallstrom
On Mon, 23 May 2005, W Luke wrote: Hi, I really struggle with regex, and would appreciate some guidance. Basically, I have a whole load of files (HTML) which are updated every few minutes. I need to go through each line, looking for the word CONFIRMED: (which is always in capitals, and always

Re: [PHP] Regex nightmares

2005-05-23 Thread John Nichel
W Luke wrote: Hi, I really struggle with regex, and would appreciate some guidance. Basically, I have a whole load of files (HTML) which are updated every few minutes. I need to go through each line, looking for the word CONFIRMED: (which is always in capitals, and always superseded by a colo

Re: [PHP] regex question

2005-05-17 Thread Al
Murry's solution here is ideal since it only captures the single occurrence. Since I want to use it for a preg_replace(), it is perfect. A couple of folks sent this pattern [EMAIL PROTECTED]@[EMAIL PROTECTED]; but, it doesn't work because I then have to remove the unwanted caracters on either si

Re: [PHP] regex question

2005-05-17 Thread Petar Nedyalkov
On Monday 16 May 2005 22:53, Al wrote: > What pattern can I use to match ONLY single occurrences of a character in a > string. > > e.g., "Some text @ and some mo@@re and [EMAIL PROTECTED], etc @@@. Use the following: /(^@)(@{1})(^@)/ This way you'll be sure the regexp will match only single occu

Re: [PHP] regex question

2005-05-16 Thread Jason Barnett
$text = 'Some text @ and some mo@@re and [EMAIL PROTECTED], etc @@@.'; /** Word boundaries before and after @ */ $regex = '/[EMAIL PROTECTED]/'; preg_match_all($regex, $text, $matches); var_dump($matches); ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.n

RE: [PHP] regex question

2005-05-16 Thread Murray @ PlanetThoughtful
> Try (for example if character was "A") ... > > ([^A]|^)A([^A]|$) > > This matches four cases: > A is at beginning of string and there is another letter after it, > A has a letter before it and a letter after it, > A is at end of string and there is a letter before it, > or A is the only charact

RE: [PHP] regex question

2005-05-16 Thread Murray @ PlanetThoughtful
> What pattern can I use to match ONLY single occurrences of a character in > a string. > > e.g., "Some text @ and some mo@@re and [EMAIL PROTECTED], etc @@@. > > I only want the two occurrences with a single occurrence of "@". > > @{1} doesn't work; there are 4 matches. > > Thanks Please

RE: [PHP] regex question

2005-05-16 Thread Murray @ PlanetThoughtful
> What pattern can I use to match ONLY single occurrences of a character in > a string. > > e.g., "Some text @ and some mo@@re and [EMAIL PROTECTED], etc @@@. > > I only want the two occurrences with a single occurrence of "@". > > @{1} doesn't work; there are 4 matches. "/[EMAIL PROTECTED]@[EM

Re: [PHP] regex question

2005-05-16 Thread Philip Hallstrom
On Mon, 16 May 2005, Al wrote: What pattern can I use to match ONLY single occurrences of a character in a string. e.g., "Some text @ and some mo@@re and [EMAIL PROTECTED], etc @@@. I only want the two occurrences with a single occurrence of "@". [EMAIL PROTECTED]@[EMAIL PROTECTED] should do it I

Re: [PHP] regex question

2005-05-16 Thread Brandon Ryan
Try (for example if character was "A") ... ([^A]|^)A([^A]|$) This matches four cases: A is at beginning of string and there is another letter after it, A has a letter before it and a letter after it, A is at end of string and there is a letter before it, or A is the only character in the string.

<    1   2   3   4   5   6   >