Re: [PHP] Preg Match Problem

2010-06-03 Thread Simcha Younger
On Wed, 2 Jun 2010 12:14:47 -0400 Alice Wei wrote: > > Hi, > > I have a code snippet here as in the following: > > [CODE] > $keywords = preg_split("/[\s,]+/", $day); > $count = count($keywords); > if(preg_match("(Mon|Tue|Wed|Thu|Fri)/i", $keywords[$i])) { //line 40 >$day_query ="start_t

RE: [PHP] Preg Match Problem

2010-06-02 Thread Alice Wei
> From: peter.e.l...@gmail.com > Date: Wed, 2 Jun 2010 18:17:00 +0200 > Subject: Re: [PHP] Preg Match Problem > To: aj...@alumni.iu.edu > CC: php-general@lists.php.net > > On 2 June 2010 18:14, Alice Wei wrote: > > > > Hi, > > > > I have a code sn

Re: [PHP] Preg Match Problem

2010-06-02 Thread Peter Lind
On 2 June 2010 18:14, Alice Wei wrote: > > Hi, > > I have a code snippet here as in the following: > > [CODE] > $keywords = preg_split("/[\s,]+/", $day); > $count = count($keywords); >  if(preg_match("(Mon|Tue|Wed|Thu|Fri)/i", $keywords[$i])) { //line 40 You're lacking the starting delimiter '/'

Re: [PHP] preg for unicode strings?

2005-11-08 Thread Richard Lynch
On Sat, November 5, 2005 3:02 pm, Andy Pieters wrote: > Hi List > > I am doing some data validation and the following regexp fails > > [\W] > > When using characters like £ or € > > Obviously because they are technically more then one character, even > though > they are only displayed as one. >

Re: [PHP] preg for unicode strings?

2005-11-06 Thread Niels Ganser
Andy, try that one: /^[a-zA-Z]{3}|\p{Sc}$/u You don't want to put \p{Sc} in square brackets as \p{Sc} itself already is a character class. Umm.. Kinda don't make myself clear here, do I? You just don't want to, it's 5am in the morning here I gotta go to the next bed ;p Regards, Niels Andy

Re: [PHP] preg for unicode strings?

2005-11-05 Thread Andy Pieters
Hi Thank you for your reply. My regexp was /^([a-zA-Z]{3,}|[\W])/ Meaning match any string that is either 3 letters or 1 word character I'd like to change this to 3 letters or 1 currency character So I changed the regexp accordingly /^([a-zA-Z]{3,}|[\p{Sc}])/u And I tested with £ but it f

Re: [PHP] preg for unicode strings?

2005-11-05 Thread Niels Ganser
Andy, you might want to check out http://www.regular-expressions.info/unicode.html Please note two things while using the described syntax: 1. You have to additionally use the u modificator. 2. While \p{Ll} for instance works in PHP, \p{Lowercase_Letter} doesn't. Regards, Niels > Hi List > >

Re: [PHP] preg for unicode strings?

2005-11-05 Thread Robin Vickery
On 11/5/05, Andy Pieters <[EMAIL PROTECTED]> wrote: > > I am doing some data validation and the following regexp fails > [\W] > When using characters like £ or € > The script is encoded in UTF-8 Are you using the 'u' modifier to put PCRE in utf-8 mode? preg_match( '/\W/u', $text); -robin

Re: [PHP] preg match

2005-01-07 Thread Rory Browne
I'm not sure what you're trying to do with preg_match, since the parameters you send to it, are from the database, and an undeclared variable $msg(which is what exactly). Unless you give us examples of the arguments to preg_match, and what you expect the results should be, as well as what they are

Re: [PHP] preg guru again.....

2004-02-23 Thread Adam Bregenzer
On Mon, 2004-02-23 at 11:36, pete M wrote: > Here is a snippet > ð­ :2002020720020208:[EMAIL > PROTECTED]://www.lyricsworld.com/cgi-bin/search.cgi?q=Bruce > +Springsteen&m=phrase&ps=20&o=0&wm=wrd&ul=&wf=1ð­ð­ð­ð­ > > it breaks down in the following elements > the :date: in the format mmdd

Re: [PHP] preg guru question

2004-02-13 Thread Adam Bregenzer
On Fri, 2004-02-13 at 13:25, pete M wrote: > Im trying to scan a file and lift the image name from the > ie > > where there could be ' or " > > I messed around but am 2 embarassed to post code cos it dont work ;-( Always post code, it can help us understand what you are looking to do. Are yo

Re: [PHP] preg guru question

2004-02-13 Thread joel boonstra
On Fri, Feb 13, 2004 at 02:19:11PM -0500, joel boonstra wrote: > if (preg_match('//ig', $dah, $matches)) { > print_r($matches); > } Doh! The '/ig' should just be '/i'. joel -- [ joel boonstra | gospelcom.net ] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] preg guru question

2004-02-13 Thread joel boonstra
On Sat, Feb 14, 2004 at 03:05:40AM +0800, Jason Wong wrote: > $doo[1] = ''; > $doo[2] = ""; > > foreach ($doo as $dah) { > if (preg_match('//i', $dah, $matches)) { > print_r($matches); > } > } Note that characters within square brackets don't need to have the | to separate them; it's a ch

Re: [PHP] preg guru question

2004-02-13 Thread Jason Wong
On Saturday 14 February 2004 02:25, pete M wrote: > Im trying to scan a file and lift the image name from the > ie > > where there could be ' or " > > I messed around but am 2 embarassed to post code cos it dont work ;-( It's always better to post something no matter how bad you may think it is

Re: [PHP] Preg Replace

2004-01-05 Thread Jason Wong
On Tuesday 06 January 2004 12:35, Aaron Axelsen wrote: > I am fighting replacing items in the following hunk of code. This code is > pulled from a database, and then I want to replace items like <> with > the contents of a variable $name. > > I have tried code like: > preg_replace("/\<\<\?.*?\>\>

RE: [PHP] preg question

2003-11-13 Thread Jake McHenry
> -Original Message- > From: zhuravlev alexander [mailto:[EMAIL PROTECTED] > Sent: Thursday, November 13, 2003 3:26 PM > To: Jake McHenry > Cc: 'John Nichel'; [EMAIL PROTECTED] > Subject: Re: [PHP] preg question > > > On Thu, Nov 13, 2003 at

Re: [PHP] preg question

2003-11-13 Thread zhuravlev alexander
On Thu, Nov 13, 2003 at 03:17:14PM -0500, Jake McHenry wrote: > What else would I need to check for? I'm tired.. Running on 2 pots of > coffee.. All I can think of is the @ and at least one . After the @, > then at least 2 characters after the last . > > I haven't had much experience with regular

RE: [PHP] preg question

2003-11-13 Thread Jake McHenry
CTED] > Sent: Thursday, November 13, 2003 3:09 PM > To: Jake McHenry > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP] preg question > > > Jake McHenry wrote: > > >>-Original Message- > >>From: Jake McHenry [mailto:[EMAIL PROTECTED] > >>Sent

RE: [PHP] preg question

2003-11-13 Thread Kevin Stone
The period is a modifier within the expression (see manual on "pattern syntax" link below). You need to escape it with a back slash: \. http://www.php.net/manual/en/pcre.pattern.syntax.php -- Kevin -Original Message- From: Jake McHenry [mailto:[EMAIL PROTECTED] Sent: Thursday, Novemb

Re: [PHP] preg question

2003-11-13 Thread John Nichel
Jake McHenry wrote: -Original Message- From: Jake McHenry [mailto:[EMAIL PROTECTED] Sent: Thursday, November 13, 2003 2:50 PM To: [EMAIL PROTECTED] Subject: [PHP] preg question Hi all, I am trying to do a simple validation of an email address being submitted. I have the @ sign being va

RE: [PHP] preg question

2003-11-13 Thread Jake McHenry
> -Original Message- > From: Jake McHenry [mailto:[EMAIL PROTECTED] > Sent: Thursday, November 13, 2003 2:50 PM > To: [EMAIL PROTECTED] > Subject: [PHP] preg question > > > Hi all, > > I am trying to do a simple validation of an email address > being submitted. I have the @ sign being

Re: [PHP] preg match compilation error

2003-10-27 Thread Curt Zirzow
* Thus wrote Marek Kilimajer ([EMAIL PROTECTED]): > Do you realy want to use [ and ] as patern delimiters? My quess is that > you want to use it for defining character class. Then the only character > that must be escaped is - > > '/[^a-z0-9,._+()\-]/i' actually, you don't even need that escape

Re: [PHP] preg match compilation error

2003-10-27 Thread Marek Kilimajer
Do you realy want to use [ and ] as patern delimiters? My quess is that you want to use it for defining character class. Then the only character that must be escaped is - '/[^a-z0-9,._+()\-]/i' Luis Lebron wrote: I found a reqular expresion that I'm using to check for valid characters in file n

Re: [PHP] preg match compilation error

2003-10-27 Thread Curt Zirzow
* Thus wrote Luis Lebron ([EMAIL PROTECTED]): > I found a reqular expresion that I'm using to check for valid characters in > file names. > > Here's the sample code: > > if(preg_match("[^a-zA-Z0-9,._\+\()\-]",$filename)) > { > //blah, blah, blah > } preg_* need a pattern deliminater (most

Re: [PHP] preg help please :)

2003-10-16 Thread Justin French
On Thursday, October 16, 2003, at 04:32 PM, Eugene Lee wrote: Try inverting the greediness with a "U" pattern modifier: "/$quote(.*)$quote:$quote(.*)$quote/U" For more details: http://www.php.net/manual/en/pcre.pattern.modifiers.php Nope -- didn't help sorry... if there's two links in a bl

Re: [PHP] preg help please :)

2003-10-15 Thread Eugene Lee
On Thu, Oct 16, 2003 at 02:23:45PM +1000, Justin French wrote: : : I have the following: : : \\1", : $text : ); : ?> : : It basically matches "link text":"url" with the added twist of having : the quotes converted to “ or “ by a previous function. : : It works fine if there is one

Re: [PHP] preg question

2003-10-08 Thread Curt Zirzow
* Thus wrote Mike J ([EMAIL PROTECTED]): > How do I take that and put it into a variable like $title? print_r($matches) will answer that. Btw, I had a typo, it should have been: preg_match("/()(.*)(<\/\\2>)/i", $html, $matches); Not preg_match_all(). Curt -- "I used to think I was indecisi

Re: [PHP] preg question

2003-10-07 Thread Curt Zirzow
* Thus wrote Mike J ([EMAIL PROTECTED]): > I want to pull the title (example) of a webpage out of some text. The > end result being "example". What preg function should I use and can someone give me > the the code that will do it? > preg_match is what you want. And if you poke around the preg_*

Re: [PHP] PREG-pattern, help needed

2003-09-09 Thread Armand Turpel
Hi, What about: $string = preg_replace("/(]*/","\\1 id={$counter}",$string); atur - Original Message - From: "Tobias Talltorp" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, September 09, 2003 6:35 PM Subject: [PHP] PREG-pattern, help needed > I need help with a preg-pat

Re: [PHP] preg, patern quantifier limit

2003-08-01 Thread David Nicholson
Hello, This is a reply to an e-mail that you wrote on Fri, 1 Aug 2003 at 20:35, lines prefixed by '>' were originally written by you. > Hi, i did a standard preg [A-Za-z0-9]{1,65536} > What i am simply trying to do is to validate the a form that will > insert > into my TEXT database field. So i ju

Re: [PHP] preg, patern quantifier limit

2003-08-01 Thread Curt Zirzow
* Thus wrote Yann Larrivee ([EMAIL PROTECTED]): > Hi, i did a standard preg [A-Za-z0-9]{1,65536} > > What i am simply trying to do is to validate the a form that will insert > into my TEXT database field. So i just want to prevent a larger insert > then expected. > > > PHP trows me this error "p

Re: [PHP] preg split question

2003-03-27 Thread CPT John W. Holmes
> i'd like to split Benutzer_CRA.php > to get CRA but sometimes the files are called > Benutzer_OVE_CRA.php and therefore the result schould OVE_CRA > how cann i tell preg_split to split the string at the > first occurence of _ and before .php preg_match("/_(.*)\.php/",$str,$matches); $matches

Re: [PHP] preg split question

2003-03-27 Thread Jonathan Pitcher
Torsten, You could use explode on the file name and then only read in the sections that you want: $FileName = "Benutzer_OVE_CRA.php"; $Part1 = explode("_", $FileName_); $TotalPart1 = count($Part1); $Wanted_File_Pieces = array(); // C = 2 so that it will skip the Benutzer part of the filename an

RE: [PHP] preg help ?

2002-09-28 Thread Thoenen, Peter Mr. EPS
// should work ... prob. a better way to do this but its functional :) -Peter > -Original Message- > From: :B nerdy [mailto:[EMAIL PROTECTED]] > Sent: Sunday, September 29, 2002 02:05 > To: [EMAIL PROTECTED] > Subject: [PHP] preg help ? > > > ive got a html document with the following

Re: [PHP] preg help (regexp newbie) whitespace

2002-07-01 Thread Jason Wong
On Tuesday 02 July 2002 10:06, Justin French wrote: > what's the correct pattern for "one or more whitespaces" (including \n\r\t > and anything else I'm missing)? I prefer the PCRE so: \s+ > what about "zero or more whitespaces"? \s* It's all in the manual! -- Jason Wong -> Gremlins Associ

Re: [PHP] preg and Perl 6 (upcoming..not current preg handling)

2002-06-26 Thread Rasmus Lerdorf
We are using the PCRE library for this. I don't think there are any plans to drop the Perl5 syntax. On Wed, 26 Jun 2002, Peter Thoenen wrote: > Anybody know if PHP 4.x (5.x?) will be sticking with > Perl5 RegEx syntax for preg's or will it be changing > to the new Perl6 RegEx syntax (which I re

Re: [PHP] preg

2002-06-11 Thread Rasmus Lerdorf
Sounds like a weird thing to want to do, but this will do it: preg_replace('/(\w)\1$/','2',$str) -Rasmus On Wed, 12 Jun 2002, Zac Hillier wrote: > Does anyone know how I can use preg or any other function to identify a > double letter on the end of a string and then replace it. > > So 'foo'

Re: [PHP] PREG

2001-12-09 Thread Hank Marquardt
Hi Matt, first it might be easier to just use split here -- $fields = split("\t",$line); I say might because I suspect that the records you have that are converting incorrectly perhaps don't follow the tab convention? ... said another way, I've never seen preg break because the file got ov

Re: [PHP] preg question

2001-04-12 Thread mark
"Michael Geier" <[EMAIL PROTECTED]> wrote: > What I need to find is all the urls in the document and make hrefs out of > them. > > ie: > http://www.mysite.com becomes href="http://www.mysite.com">http://www.mysite.com; > > any ideas? TIA! I use this code in my PHPost project: