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

[PHP] Preg Match Problem

2010-06-02 Thread Alice Wei
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_time.day='12345' AND end_time.day='12345'"; } if(preg_match("Sat

[PHP] preg-replace-callback problem

2008-03-18 Thread Khaled Mamdouh
In url http://www.php.net/manual/en/function.preg-replace-callback.php I read this example: '.$input[1].'';}return preg_replace_callback($regex, 'parseTagsRecursive', $input);}$output = parseTagsRecursive($input);echo $output;?> example does not work if there are more deep stateme

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

[PHP] preg for unicode strings?

2005-11-05 Thread Andy Pieters
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. The script is encoded in UTF-8 Anybody know a fix for this? With kind reg

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

[PHP] preg match

2005-01-07 Thread Chandana Bandara
This php script perform matching text of some certain URLs. but in this preg_match it wont match few patterns < _ . with help of this script , can some body help me to match the other all patterns .plz ? "; if ( preg_match("/$chk_msg/", "$msg", $match) ) {

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

[PHP] preg guru again.....

2004-02-23 Thread pete M
Am trying to do a strange thing with php.. Extract the urls from the Internet Explorer index.dat history files (dont ask why!) 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

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

[PHP] preg guru question

2004-02-13 Thread pete M
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 ;-( thanks in advance pete -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

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("/\<\<\?.*?\>\>

[PHP] Preg Replace

2004-01-05 Thread Aaron Axelsen
Hello, 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("/\<\<\?.*?\>\>/",$name,$paypal); However it doesn't work, any suggestion

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
: Thursday, November 13, 2003 12: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 validated, but I can't get the period to work.. Can someone help me out? Here's my co

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

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 s

[PHP] preg question

2003-11-13 Thread Jake McHenry
Hi all, I am trying to do a simple validation of an email address being submitted. I have the @ sign being validated, but I can't get the period to work.. Can someone help me out? Here's my code.. if ($_POST['Travel_Request_Email_Address'] != "") { if (preg_match_all("/(@)/", $_POS

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

[PHP] preg match compilation error

2003-10-27 Thread Luis Lebron
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 } However, when I run the script I get the following error: Warning: Compilation failed: unmatched paren

Re[2]: [PHP] preg help please :)

2003-10-16 Thread Tom Rogers
Hi, Friday, October 17, 2003, 10:26:40 AM, you wrote: JF> 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/p

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

[PHP] preg help please :)

2003-10-15 Thread Justin French
Hi, 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 link found inside a string, but falls over horribly if there's two links inside

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

[PHP] preg question

2003-10-07 Thread Mike J
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? J. PS. I've been on php.net trying to figure it out. -- ___ Get

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

[PHP] PREG-pattern, help needed

2003-09-09 Thread Tobias Talltorp
I need help with a preg-pattern for preg_replace_callback(). I need to match and replace them with . This is as far as I have come in my code: tabell2 cell1 tabell2 cell2 första cell i rad två Detta är den sista '; $counter = 0; function bla($matches) { global $counter; $counter++; re

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

[PHP] preg, patern quantifier limit

2003-08-01 Thread Yann Larrivee
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 "preg_match(): Compilation failed: number too big in {} quantifier

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

[PHP] preg split question

2003-03-27 Thread Torsten Rosenberger
Hello 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 BR/Torsten -- PHP General Mailing List (

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 doc

[PHP] preg help ?

2002-09-28 Thread :B nerdy
ive got a html document with the following string in it: what i want to do is get the string which corresponds to value. so that is \oiXESASZC?~adQXZDQ?_ ive used preg_match_all ('', $contents,$out, PREG_PATTERN_ORDER); but it returns the whole document :( a little help? cheers -- PHP Gen

[PHP] Preg replace & Query Problem

2002-07-29 Thread Alex Beauclair
Hi, I'm having trouble with preg_replace and a mysql query. Here's my code : $query = $db->query("SELECT style FROM ".$table_styles." WHERE id = '1'"); $r = $db->fetch_array($query); $style_1 = $r[style]; $query = $db->query("SELECT id, name, description FROM ".$table_categories.""); while($r =

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

[PHP] preg help (regexp newbie) whitespace

2002-07-01 Thread Justin French
Hi all, what's the correct pattern for "one or more whitespaces" (including \n\r\t and anything else I'm missing)? what about "zero or more whitespaces"? Thanks in advance, Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

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

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

2002-06-26 Thread Peter Thoenen
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 really dislike but what can you do, Larry has spoken). If we do plan to move to Perl6 RegEx, please implement the P5 modifier -Peter

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'

[PHP] preg

2002-06-11 Thread Zac Hillier
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' would become 'f2' and 'bar' would not change. Thanks Zac -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsu

[PHP] Preg Match

2001-12-20 Thread phantom
I am passing a string and making sure all the characters in that string are valid. Example: For a persons age I am using: if (!preg_match("/^[0-9]+$/", $Age)) echo "Please Enter numeric value for age". But how would I include the following characters as permissible in preg match ~!@#$%^&*()

[PHP] preg match question

2001-12-14 Thread phantom
I am passing a string and making sure all the characters in that string are valid. Example: For a persons age I am using: if (!preg_match("/^[0-9]+$/", $Age)) echo "Enter numeric value for age". But how would I include the following characters as permissible in preg match ~!@#$%^&*()-=_+,.?

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

[PHP] PREG

2001-12-07 Thread Matthew Moreton
Hi people. I am having some trouble with the PREG functions in php. Here's what I am trying to do... First of all I am reading in a file which is 1.5mb's in size, it could be many more, going up to 8mb's, the contents of the file is input to a string. The format of the file is as follows...

[PHP] preg vs ereg (performance)

2001-05-04 Thread Matthew Aznoe
I am in the process of writing an application that does a lot of parsing in which performance is the key. In the process, I performed some rudimentary speed testing that yielded some interesting results. Rather than keep them to myself, I thought I would share them. I am currently parsing out t

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:

[PHP] preg question

2001-04-12 Thread Michael Geier
on http://www.php.net/manual/en/function.preg-match-all.php there is a regex: $url = "http://www.catho.com.br/index.phtml"; $contents = Implode("", File($url)); preg_match_all("|href=\"?([^\"' >]+)|i", $contents, $arrayoflinks); While(List(,$link) = Each($arrayo