Rene Fournier wrote:
Hi, I'm looking for some ideas on the best way to parse blocks of text
that is formatted such as:
$sometext %\r\n-- good data
$otherstring %\r\n-- good data
$andyetmoretext %\r\n-- good data
ctype_alpha ( string $text )
Adil Drissi wrote:
Hi,
Is there any way to limit the user to a set of characters for example say i
want my user to enter any character between a and z (case insensitive). And if
the user enters just one letter not belonging to [a-z], this will not be
accepted.
Adil Drissi wrote:
Hi,
Is there any way to limit the user to a set of characters for example say i
want my user to enter any character between a and z (case insensitive). And
if the user enters just one letter not belonging to [a-z], this will not be
accepted.
I tried eregi('[a-z]',
Get Sams, Teach yourself Regular Expressions It's a great little, simple book.
Then get the Regex Coach. Google to find it. It's free, works great and is
super for learning regex
Børge Holen wrote:
Ok I seem to need to learn regular expressions more than anything.
this is what im working
On Sunday 19 November 2006 23:25, Al wrote:
Get Sams, Teach yourself Regular Expressions It's a great little, simple
book.
I'll look that one up. Thank you =)
Then get the Regex Coach. Google to find it. It's free, works great and is
super for learning regex
And this one, I'm on right
Paul Goepfert wrote:
I have one small problem I don't understand the preg_replace() method.
I understand the gist of what it does but I still don't fully know
what it does. I have read the entry in the php manual about this and
I am still confused about it. I've never been any good with
* Khorosh Irani [EMAIL PROTECTED]:
Hello
I have a question:
What is in the role of space in the regular expressions (POSIX)?
To match a space.
--
Matthew Weier O'Phinney | WEBSITES:
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association|
In article [EMAIL PROTECTED], Arik Raffael Funke wrote:
implement following pattern Last Name:\s*(.*)\n.
I get just 'Jason'. But what I currently get is:
Jason
Street: abc
This is behaviour because (.*) is greedy.
As you noticed, it matched Jason \nStreet:abc
/Last Name:\s+(.*?)\n/
--
Yep, but to avoid his problem with empty Strings he should use
something like:
/Last Name: *(.*?)\n/
outerwise \s* will match the first newline and continue to the end
of the next line !
Tim Van Wassenhove wrote:
In article [EMAIL PROTECTED], Arik Raffael Funke wrote:
implement following pattern
Oh guess it would be even better and faster to only use:
/Last Name:([^\n]*)/
and trim() the result :-)
-- red
Red Wingate wrote:
Yep, but to avoid his problem with empty Strings he should use
something like:
/Last Name: *(.*?)\n/
outerwise \s* will match the first newline and continue to the end
In article [EMAIL PROTECTED], Red Wingate wrote:
Oh guess it would be even better and faster to only use:
/Last Name:([^\n]*)/
In most environments is strpos and substr even faster ;)
--
Tim Van Wassenhove http://home.mysth.be/~timvw
--
PHP General Mailing List (http://www.php.net/)
To
I've always found the PHP manual to be very helpful:
http://www.php.net/manual/en/pcre.pattern.syntax.php
Pete M wrote:
Getting completely confused how this stuff works !!!
Anyone recommend a book for a regex newbie ?
pete
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
I also forgot to mention this book, which I've never used, but I picked
it up once and it seemed very helpful:
Regular Expression Pocket Reference
published by O'Reilly
http://www.amazon.com/exec/obidos/tg/detail/-/059600415X/qid=1077025752/sr=1-2/ref=sr_1_2/102-1251244-5472167?v=glances=books
Fernando Melo wrote:
I have the following statement:
$text = ereg_replace
([live/]*content\.php\?[]*Item_ID=([0-9]*)Start=([0-9]*)Category_ID=([0-
9]*)[]*, content\\1start\\2CID\\3.php, $text);
Basically what I'm trying to do is if the URL includes live/ then I want
to include it in the
Um! This is like an OCR error.
Maybe you'll need a dictionary and craft a soundex/diffin' scheme. I don't
think regexp will solve this problem nicely.
Manu.
Shmuel [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I have a misspelled sentence like this: I am not aIone.
I want to change
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (J. Younker)
wrote:
Hi,
I'm trying to use eregi_replace to check a user-submitted URL, but I
keep getting the following error message:
Warning: Invalid range end in /var/www/html/_db_db/db_input.php
This what I'm using:
$pattern =
In article [EMAIL PROTECTED],
[EMAIL PROTECTED] (Ed Lazor) wrote:
I've been banging my head against regular expressions all night... help
would be greatly appreciated. Could you give me examples on how to do the
following?
Pull everything except a specific word from a sentence.
snip
On Sat, 06 Apr 2002 15:01:24 +0300, Ando [EMAIL PROTECTED] wrote:
(eregi((frame[^]*src[[:blank:]]*=|href[[:blank:]]*=|http-equiv=['\]refresh['\]
You might want to try using preg_match instead. The PCRE engine should
be significantly faster. You might also find the ability to pass an
array of
I think you have some un-needed code there. But anyway you might need to use
a double backslash infront of the |
If that doesn't work mail me back
Muz
German Castro Donoso [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
I have a problem with ereg function.
In
yeah! remember that php interprets the string first, before it gets to
reg.ex. !! That's some I keep forgetting... lol
Martin
-Original Message-
From: Murray Chamberlain [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 22, 2002 2:48 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: regular
Use single quotes? I think that stops it from interpreting the regular
expression before hand.
-Original Message-
From: Martin Towell [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 22, 2002 10:32
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Re: regular expressions
yeah! remember
Thanks robin, this is very useful!
Robin Vickery wrote:
[EMAIL PROTECTED] (Mike Gifford) writes:
Hello,
I'm trying to replace a couple of lines of code:
$dotpos = 1 - (strlen($userfile_name) - strpos($userfile_name, '.'));
$extension = substr($userfile_name, $dotpos);
with a
Thanks..
_lallous wrote:
?
$str = /home/mike/test.txt;
if (preg_match(/[^\.]+$/, $str, $matches))
$ext = $matches[0];
else
$ext = no extension;
echo extension=$ext;
?
Mike Gifford [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Hello,
I'm trying
On Mon, 10 Sep 2001, Mike Gifford wrote:
Thanks robin, this is very useful!
yep, although pathinfo() is much easier:
$extension = pathinfo($userfile_name, PATHINFO_EXTENSION);
-Sterling
Robin Vickery wrote:
[EMAIL PROTECTED] (Mike Gifford) writes:
Hello,
I'm trying to
?
$str = /home/mike/test.txt;
if (preg_match(/[^\.]+$/, $str, $matches))
$ext = $matches[0];
else
$ext = no extension;
echo extension=$ext;
?
Mike Gifford [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Hello,
I'm trying to replace a couple of lines of
[EMAIL PROTECTED] (Mike Gifford) writes:
Hello,
I'm trying to replace a couple of lines of code:
$dotpos = 1 - (strlen($userfile_name) - strpos($userfile_name, '.'));
$extension = substr($userfile_name, $dotpos);
with a simpler regular expression:
$extension =
Your three str_replace calls might be faster anyway...
--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message
In article 000b01c10f4a$d569c5c0$0300a8c0@sparlak,
[EMAIL PROTECTED] (Philip Murray) wrote:
In Perl you can do this:
$foo =~ tr/012/mpf/;
Which is the same as:
$foo = str_replace(0, m, $foo);
$foo = str_replace(1, p, $foo);
$foo = str_replace(2, f, $foo);
in PHP.
(eregi("([0-9][a-z][A-Z]\.[0-9][a-z][A-Z]", $myArray[x]))
and don't use character '^' in front of the pattern.
-toto-
Jason Caldwell writes:
I'm looking to compare if my array values match any digits or alpha
characters with a dot between them... so, if I think I understand Regular
29 matches
Mail list logo