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
> 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
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 '/'
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
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
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.
>
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
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
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
>
>
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
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
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
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) ) {
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
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
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
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:
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
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
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
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("/\<\<\?.*?\>\>
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
> -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
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
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
: 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
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
> -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
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
* 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
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
* 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
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
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
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
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
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
* 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
* 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_*
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
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
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
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
* 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
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
> 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
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
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 (
// 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
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
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 =
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
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
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
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
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'
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
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
~!@#$%^&*()
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
~!@#$%^&*()-=_+,.?
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
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...
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
"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:
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
64 matches
Mail list logo