I'm wondering if Regular Expressions are the same in Perl and PHP (and
possibly Actionscript)? They look the same and smell the same, but if
I see a book in a store for Perl Regular Expressions that's $10
cheaper than the PHP one (is there one?), then is it the same thing?
this page will
Thanks for the suggestions. Between the online manual and the books I have I
think I'll get there eventually. Sometimes my logic just sux. What I needed
to do was have the user fill out a form and if they make changes to the XML
file I would update the file. So, my long way around was to go
* Thus wrote Gabino Travassos ([EMAIL PROTECTED]):
Hello
I'm wondering if Regular Expressions are the same in Perl and PHP (and
possibly Actionscript)? They look the same and smell the same, but if I see
a book in a store for Perl Regular Expressions that's $10 cheaper than the
PHP one (is
I believe Regular Expressions are language independent. Here is an
O'Reilly book on the matter:
http://www.oreilly.com/catalog/regex2/
Chris W. Parker wrote:
Gabino Travassos mailto:[EMAIL PROTECTED]
on Thursday, April 22, 2004 12:24 PM said:
I'm wondering if Regular Expressions are the
Saturday, April 10, 2004, 2:02:04 AM, you wrote:
I'm trying to 'clean up' some text that is extracted from a web
directory, and I need to use (I think) preg_replace or ereg_replace,
etc. I've read a bunch of tutorials, but none of them seem to cover the
particular thing I want to do. Here's
What exactly does this do:
/ (?=p|br) [^]+ /x
It may work, I just want to understand what it's looking for.
Thanks,
Matt
Curt Zirzow [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
* Thus wrote Matt Palermo ([EMAIL PROTECTED]):
I have a page where I am stripping the html tags
* Thus wrote Matt Palermo ([EMAIL PROTECTED]):
What exactly does this do:
Your original expression:
/ (?!p|br) [^]* /x
Find '' not followed by 'p|br' until the first '' we find.
p class=foo - matches
- matches
Its a bit confusing as why the p * matches, perhaps
* Thus wrote Matt Palermo ([EMAIL PROTECTED]):
I have a page where I am stripping the html tags down. Basically, it will
allow certain tags, but still strips out ALL attributs of the tag, so it
works something like this:
$allowed_tags = pbrstrongbiu;
// State which tags are allowed
$info
snip
Anyone recommend a book for a regex newbie ?
/snip
O'Reilly usually has some good stuff
http://www.oreilly.com/catalog/regex/
There is plenty of tutorials online too, just google and you will get a
bunch of results.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
Pete,
you can probably do what you want with preg_replace_callback:
http://nl2.php.net/manual/en/function.preg-replace-callback.php
only the function call will be set up slightly differently; namely you
don't pass the callback reference directly, instead the callback
function that is called
From: Jochem Maas [EMAIL PROTECTED]
alternatively (actually this looks like the easier way to do it!) use
preg_replace(), with the 'e' modifier tagged onto the end of the
replacement expression: the 'e' modifier causes the expression to be
evaluated as PHP.
Thank you very much Jochem and John. It works like a charm now, and I
was beginning to grow weary after experimenting with result sets for
almost 10 hours now.
How would you - by the way - concatenate text to the replacement
string?
;-Pete
On Tue, 3 Feb 2004 14:15:00 -0500, [EMAIL PROTECTED]
replacement is evaluated... therefore:
function check_this_out($arg) {
return a href='#'$arg/a;
}
$myString = 'hello';
$pattern = '/(.*)/e';
$replacement = check_this_out('\\1' . ' $myString');
echo preg_replace($pattern, $replacement, 'test says:');
[EMAIL PROTECTED] wrote:
Thank you very
On Thu, Nov 27, 2003 at 01:20:57PM +0400, Sheni R. Meledath wrote:
:
: Could anybody help me to create a regular expression to remove a pattern
: from a string.
:
: $querystring =
http://10.100.1.7/cdms/prfl.phtml?action=searchcusttype=1gender=x=22y=10page=2
:
: I would like to remove page=2
On Thu, 27 Nov 2003, Eugene Lee wrote:
Instead of using regexps on the URL, it might be easier (and safer) to
loop through $_GET, build a new $geturl array, add/delete/change any
variables in $geturl, then build a new $geturlstr string that can then
be appended to your hyperlinks.
What about
* Thus wrote Fernando Melo ([EMAIL PROTECTED]):
Hi all,
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
preg_replace(/aIone/, alone, I am not aIone);
But you don't need regular expressions for this.
Jacob
On Thu, 2003-10-16 at 14:35, Shmuel wrote:
I have a misspelled sentence like this: I am not aIone.
I want to change the capital I to small l, but only in
the beginning of a word.
How is
On Thursday, October 16, 2003, at 10:35 PM, Shmuel wrote:
I have a misspelled sentence like this: I am not aIone.
I want to change the capital I to small l, but only in
the beginning of a word.
How is this done in regular expression ?
You want to change an uppercase i/I into a lowercase l/L??
On Thu, Oct 16, 2003 at 03:35:57PM +0300, Shmuel wrote:
:
: I have a misspelled sentence like this: I am not aIone.
: I want to change the capital I to small l, but only in
: the beginning of a word.
This doesn't make sense. It sounds like you want to replace every
occurance of 'I' inside a
Eugene Lee wrote:
On Thu, Oct 16, 2003 at 03:35:57PM +0300, Shmuel wrote:
:
: I have a misspelled sentence like this: I am not aIone.
: I want to change the capital I to small l, but only in
: the beginning of a word.
This doesn't make sense. It sounds like you want to replace every
occurance
On Thu, Oct 16, 2003 at 09:41:39PM +0300, Shmuel wrote:
: Eugene Lee wrote:
: On Thu, Oct 16, 2003 at 03:35:57PM +0300, Shmuel wrote:
: :
: : I have a misspelled sentence like this: I am not aIone.
: : I want to change the capital I to small l, but only in
: : the beginning of a word.
:
: This
* Thus wrote Shmuel ([EMAIL PROTECTED]):
Eugene Lee wrote:
On Thu, Oct 16, 2003 at 03:35:57PM +0300, Shmuel wrote:
:
: I have a misspelled sentence like this: I am not aIone.
: I want to change the capital I to small l, but only in
: the beginning of a word.
This doesn't make sense. It
$str = (this)example;
preg_match(/\((.*?)\)(.*)/,$str,$regs);
$a[0] = $regs[1];
$a[1] = $regs[1].$regs[2];
On Wed, 30 Oct 2002, Simon Dedeyne wrote:
I have a little question. I'm having some difficulty with regular
expressions:
here it is:
(this)example
If I understand you correctly, I think you want this?
$matches = array();
$test = (this)example;
preg_match(/\((.*)\)(.*)/, $test, $matches);
array_shift($matches);
On Wed, 30 Oct 2002, Simon Dedeyne wrote:
I have a little question. I'm having some difficulty with regular
expressions:
Whoops.. I missed one bit. Rasmus did it right. ;)
On Wed, 30 Oct 2002 [EMAIL PROTECTED] wrote:
If I understand you correctly, I think you want this?
$matches = array();
$test = (this)example;
preg_match(/\((.*)\)(.*)/, $test, $matches);
array_shift($matches);
On Wed, 30 Oct 2002,
On Sunday 04 August 2002 01:44, Jürgen wrote:
Anybody please tell me why the following is not working
$test = Hello, end why is not workin, END.;
//before
echo $test . br;
//Finds beginning of a line, followed by e or E, and replaces it with A. At
least it should do it, but it doesn't
Well, i know it should work, but it does not work.
Even if i Change the first letter into e or E it does not work.
This is so frustrating, this is prolly the most easiest regular expression i
could start with and yet i fail and nobody seems to know why it aint working
neither
This should
On Sunday 04 August 2002 03:47, Jürgen wrote:
Well, i know it should work, but it does not work.
Even if i Change the first letter into e or E it does not work.
This is so frustrating, this is prolly the most easiest regular expression
i could start with and yet i fail and nobody seems to
No im not saying that, im merely saying that in my given example even if i
turn the Hello into Ello it does not replace it, besides :
^ = assert start of subject (or line, in multiline mode) *
I
not sure why you have such a complex reg there, but will this work for you.
preg_replace(/(http:\/\/)?([^\/ ]*)(.*);/, http://\\2\\3;, $str);
\\1 = http:// ; if there
\\2 = domain
\\3 = request_uri
Jim Lucas
- Original Message -
From: J. Younker [EMAIL PROTECTED]
To: [EMAIL
Thanks, Jim!
That's exactly what I needed.
J.
Jim Lucas wrote:
not sure why you have such a complex reg there, but will this work for you.
preg_replace(/(http:\/\/)?([^\/ ]*)(.*);/, http://\\2\\3;, $str);
\\1 = http:// ; if there
\\2 = domain
\\3 = request_uri
Jim Lucas
-
On Fri, 31 May 2002 12:32:29 +0100, you wrote:
example of the contents of $file that might pass is:
advance_racingx_14_4_29.pdf
another might be, which would not pass is:
advance_fork10_3_4_11.pdf
If you need it to be in that specific order, use the following:
On Tuesday 30 April 2002 15:51, 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?
Is this for a programming assignment/exercise? Do you /have/ to use regex?
Other
-Original Message-
From: John Fishworld [mailto:[EMAIL PROTECTED]]
Sent: 30 April 2002 09:32
I'm trying to find files in my array
for example
=lg_imode.gif
and
=/db/imodeklein/edgar-IMODE-1-.gif
I want to differentiate between the files with slash at the
front and ones
On Tuesday 30 April 2002 16:31, John Fishworld wrote:
I'm trying to find files in my array
for example
=lg_imode.gif
and
=/db/imodeklein/edgar-IMODE-1-.gif
Perhaps you should clarify your problem. First of all does your array contain
just gif files (ie *.gif) or does it contain all sorts
Okay right I'm experimenting with an i-mode parser !
I copy the file (url entered) to a local location !
Then read through the whole file line at a time and change/replace the
things that need replaceing !
On of the things that I need to replace is the links to the pictures so that
they still
On Tuesday 30 April 2002 19:17, John Fishworld wrote:
Okay right I'm experimenting with an i-mode parser !
I copy the file (url entered) to a local location !
Then read through the whole file line at a time and change/replace the
things that need replaceing !
On of the things that I need to
$imode_code = file($url_file);
$file_name = basename($url_file);
$path = dirname($url_file);
$stripped_path = eregi_replace(^(.{2,6}://)?[^/]*/, , $path);
$next_path = eregi_replace($stripped_path, , $path);
$next_path_1 = eregi_replace(/$ , , $next_path);
// create and open a file to write to
On Tuesday 30 April 2002 19:43, John Fishworld wrote:
$imode_code = file($url_file);
$file_name = basename($url_file);
$path = dirname($url_file);
$stripped_path = eregi_replace(^(.{2,6}://)?[^/]*/, , $path);
On Tuesday 30 April 2002 19:17, John Fishworld wrote:
Okay right I'm
Duh ! lol sorry !
Example 1
html
head
meta http-equiv=content-type content=text/html;charset=iso-8859-1
meta name=generator content=Edit Plus
titleLocations/title
/head
body bgcolor=#6699FF
div align=center
pfont color=blackWelcome tobr
/fontfont color=redimg src=lg_imode.gif alt=
On Tue, 30 Apr 2002, Ed Lazor wrote:
Pull everything except a specific word from a sentence. For example,
pulling everything except the word run from the water run was steep.
$str = 'the water run was steep';
print preg_replace('/(\s*water)/', '', $str);
Pull all words from a string
On Tuesday 30 April 2002 21:09, John Fishworld wrote:
Duh ! lol sorry !
img src=/db/imodeklein/edgar-IMODE-1-.gif vspace=2br#59091;nbsp;a
href=imode.fpl?op=imodecardprefix=IMODEnummer=1suffx=uid=55%2eFAGAEpa
Unfortunately, no. Could you post say 20 lines of this file you're
talking
Thanks after playing about with that I've got the following which does seem
to work !
$imode_code[$i] = eregi_replace((src=)(\)([a-z0-9_\/-]+\.gif)(\),
\\1\\2$path/\\3\\2, $imode_code[$i]);
Very very very slowly getting the hang of regexs !
What does your /i do at the end ???
Thanks
Try
On Wed, 1 May 2002, John Fishworld wrote:
Thanks after playing about with that I've got the following which does seem
to work !
$imode_code[$i] = eregi_replace((src=)(\)([a-z0-9_\/-]+\.gif)(\),
\\1\\2$path/\\3\\2, $imode_code[$i]);
Very very very slowly getting the hang of regexs !
aha !
thats very strange then because mine works at the moment but if I add the /i
at the end then it doesn't !
On Wed, 1 May 2002, John Fishworld wrote:
Thanks after playing about with that I've got the following which does
seem
to work !
$imode_code[$i] =
I wasn't paying that much attention. The /i is a preg thing. It's the same
as changing from ereg to eregi.
miguel
On Wed, 1 May 2002, John Fishworld wrote:
aha !
thats very strange then because mine works at the moment but if I add the /i
at the end then it doesn't !
On Wed, 1 May 2002,
, April 23, 2002 4:38 PM
To: Devin Atencio; [EMAIL PROTECTED]
Subject: Re: [PHP] Regular Expressions
Uhhh... something like
ereg([_a-zA-Z\-]+\@[\.a-zA-Z\-]+\.com,$variable);
SHOULD work... If you want to make sure they're @domain.com instead of any
domain, try...
ereg([_a-zA-Z\-]+\@[\.a-zA-Z
On Wed, 24 Apr 2002, Evan Nemerson wrote:
ereg(([_a-zA-Z\-]+|\*)\@[\.a-zA-Z\-]+\.com,$variable);
should work, but test it. I'm not 100% the wildcard part will work.
An internet domain name cannot contain an underscore ( _ ).
...and a whole lot of them don't end in .com!
miguel
--
PHP
A domain cannot contain an underscore, but unless i'm mistaken the USERNAME
can. the domain name REGEX is [\.a-zA-Z\-]+
You're right about the .com. senior moment. here's a better version
ereg(([_a-zA-Z\-]+|\*)\@[\.a-zA-Z\-]+\.[\.a-zA-Z\-]+,$variable);
won't make sure there are letters
On Wed, 24 Apr 2002, Evan Nemerson wrote:
A domain cannot contain an underscore, but unless i'm mistaken the
USERNAME can. the domain name REGEX is [\.a-zA-Z\-]+
ereg(([_a-zA-Z\-]+|\*)\@[\.a-zA-Z\-]+\.[\.a-zA-Z\-]+,$variable);
Right you are. I spaced out right past the .
But on the other
: Miguel Cruz [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 24, 2002 5:17 PM
To: Evan Nemerson
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Regular Expressions
On Wed, 24 Apr 2002, Evan Nemerson wrote:
A domain cannot contain an underscore, but unless i'm mistaken the
USERNAME can
don't know if it does any checking or validating or what...but maybe
it'll help??
---John Holmes...
-Original Message-
From: Miguel Cruz [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 24, 2002 5:17 PM
To: Evan Nemerson
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Regular
Okay...
ereg(([_a-zA-Z\-\=\+0-9]+|\*)\@[\.a-zA-Z\-0-9]+\.[\.a-zA-Z\-0-9]+,$variable);
Anything else? That one works, right???
So far we've got a-z, A-Z, underscores, hyphens, equals, and pluses. Oh crap
numbers! Okay added it in up there. Anything else?
On Wednesday 24 April 2002 17:17
Uhhh... something like
ereg([_a-zA-Z\-]+\@[\.a-zA-Z\-]+\.com,$variable);
SHOULD work... If you want to make sure they're @domain.com instead of any
domain, try...
ereg([_a-zA-Z\-]+\@[\.a-zA-Z\-]+domain\.com,$variable);
if you want to validate e-mail address formats, there is (if memory
PIII 400MHz, 512Mb, SuSe 6.4, 2.2.14 smp, php 3.0.16, Completed in
0.76187908649445 seconds
PIII 350MHz, 256Mb, Suse 7.3, 2.4.9, php 4.0.6, Completed in
2.6342689990997 seconds
File Size:28537kb,
But for real tests, send the original file you use direct
BTW How the hell did you develop this
With there be a specifc number of variables returne? Or can the number of
variables vary?
-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 1:26 PM
To: '[EMAIL PROTECTED]'
Subject: [PHP] Regular Expressions? Help!
I am trying to do a match
'; '[EMAIL PROTECTED]'
Subject:RE: [PHP] Regular Expressions? Help!
With there be a specifc number of variables returne? Or can the number of
variables vary?
-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 1:26 PM
To: '[EMAIL PROTECTED
. Any
ideas?
-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 1:54 PM
To: 'Walker, Roy'
Subject:RE: [PHP] Regular Expressions? Help!
well, ya might try:
$my_array = explode( \ ,$output);
this would set:
$my_vars[0] = variable1
exec()
-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 2:05 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [PHP] Regular Expressions? Help!
I just realized why nothing I was trying for the regular expressions wasn't
working. The command I am
Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 2:07 PM
To: 'Walker, Roy'; '[EMAIL PROTECTED]'
Subject:RE: [PHP] Regular Expressions? Help!
exec()
-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25
PROTECTED]]
Sent: Monday, March 25, 2002 2:27 PM
To: 'Rick Emery'; '[EMAIL PROTECTED]'
Subject: RE: [PHP] Regular Expressions? Help!
Perhaps it is how I am calling the $lines in a while loop.? I have tried
`$cmd`, exec(), exec($cmd, $ouput) (to capture the output as an array),
system(), shell_exec
:50 PM
To: 'Walker, Roy'; '[EMAIL PROTECTED]'
Subject:RE: [PHP] Regular Expressions? Help!
exec() works for me.
Remember, though, it returns only the LAST line. Have you tried the
following to ensure it's constructing the command you think it is:
$mycmd = $prog $cmdline $trimline
]'
Subject: RE: [PHP] Regular Expressions? Help!
The cmd is running running correctly as I see the output on the screen (this
is being run from a command line). The command output is seen on the screen
and nothing gets set to $output.
-Original Message-
From: Rick Emery [mailto:[EMAIL
'; '[EMAIL PROTECTED]'
Subject:RE: [PHP] Regular Expressions? Help!
Again, I ask:
Does $mycmd contain the command you expect to see
$mycmd = $prog $cmdline $trimline ;
print $mycmd;
$output = exec($mycmd);
-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday
When the exec'd program executes from the command line, does it output a
blank line as its last line?
-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 2:05 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [PHP] Regular Expressions? Help!
I just
No. I think there is a carriage return (\n), but there is not a blank line
at the end.
-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 3:07 PM
To: 'Walker, Roy'; '[EMAIL PROTECTED]'
Subject:RE: [PHP] Regular Expressions
: Monday, March 25, 2002 3:09 PM
To: 'Rick Emery'; '[EMAIL PROTECTED]'
Subject: RE: [PHP] Regular Expressions? Help!
No. I think there is a carriage return (\n), but there is not a blank line
at the end.
-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25
At 25.03.2002 14:26, you wrote:
Perhaps it is how I am calling the $lines in a while loop.? I have tried
`$cmd`, exec(), exec($cmd, $ouput) (to capture the output as an array),
system(), shell_exec(). None of them let me capture the STDOUT from the
program. There has to be a way to do this.
Good day,
exec() isn't very good at capturing output. It will only return the last
line of output, which is designed mostly to capture error conditions.
You would be best off using popen() and attaching a pipe to the output, and
then just read from the pipe. More information can be found
exec() can capture ALL output from a command if you supply an array as the
second argument to it
-Original Message-
From: Darren Gamble [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 3:58 PM
To: 'Walker, Roy'; '[EMAIL PROTECTED]'
Subject: RE: [PHP] Regular Expressions? Help
PM
To: 'Darren Gamble'; 'Walker, Roy'; '[EMAIL PROTECTED]'
Subject:RE: [PHP] Regular Expressions? Help!
exec() can capture ALL output from a command if you supply an array as the
second argument to it
-Original Message-
From: Darren Gamble [mailto:[EMAIL PROTECTED]]
Sent
first of all:
why do you use:
[0-9][0-9]*...
you better use: [0-9]+ then
same goes for \w
and I guess you don't need the ('s and )'s either...
Edward
- Original Message -
From: German Castro Donoso [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, February 21, 2002 5:26 PM
On Friday 18 January 2002 22:09, Tony Arnold wrote:
Howdy people... I want to extract the name of a hyperlink which looks like
this:
a href=this is the name!/a
I tried to do this:
ereg(([a-zA-Z0-9_. -]*),$hlink, $reg3);
and it works if it only consists of the above characters, how can I
Thank you!
-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED]]
Sent: den 18 januari 2002 15:14
To: Tony Arnold; [EMAIL PROTECTED]
Subject: Re: [PHP] Regular Expressions...
On Friday 18 January 2002 22:09, Tony Arnold wrote:
Howdy people... I want to extract the name
At 10:16 PM 1/5/2002 -0500, Gerard Samuel wrote:
Need some help with this one. Dont know where to begin. I have content
in a string and a constant that changes depending on if yourre in the root
or in a directory.
The purpose of the constant is to provide dynamic links.
The string will have
At 10:22 PM 1/5/2002 -0600, Michael Sims wrote:
function insertpath($string) {
return preg_replace(/(a
href=\)(.*\.*\/a)/i,$1._CONSTANT.$2,$string);
}
?
Forgot to mention that the i at the end of the regex means to make the
match case-insensitive...
--
PHP General Mailing List
$message = preg_match (~\[color=([\w#]+)\](.*?)\[/color\]~, font
color=$1$2/font);
try with this
- Original Message -
From: Jeff Lewis [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, November 20, 2001 3:37 PM
Subject: [PHP] Regular Expressions.
I'm trying to port over some Perl
I ran into that problem also when I first tried to script with PHP.
1.
preg_match(/yourexpression/,$text,$matches);
always set the / at beginning and end of the regex (as you did in perl)
2.
preg_match(/\[/,
this won't match the char [ because of the double-quotes () it
If you'd really like to develop your regex skills, and everyone should,
pickup Mastering Regular Expressions by Jeffrey Friedl(O'Reilly Press). Its
the best out there, and will probably teach you more than you thought
possible.
Jack
-Original Message-
From: Martin Thoma [mailto:[EMAIL
?php
$quoted = preg_quote($searchstring, '!');
preg_match_all('!(\w+)(?[^]*).*'.$quoted.'(?[^]*)/$1!Ui', $source, $matches);
?
good point to start:
http://www.php.net/manual/en/ref.pcre.php
- Original Message -
From: Martin Thoma [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Hello!
You should write something like this:
if (preg_match(/H2(.*)\/H2/Ui, $str, $matches))
echo $matches[1];
U modufier - ungreedy match
i modifier - case insentensive
Where can I start to learn reg-exp?
If you want to get more abot regexp - read php manual at least.Or try to
find
below
HEy, i am having major problems trying to work out this regular expression.
Regular expressions are still quite new to me, and i don't fully understand
them, so please bear with me... thanks!
regex is a different beast... however if the text that you have isa actually as
such, it is
$line = htmlentities(stripslashes($line));
$line = nl2br($line);
$line = eregi_replace(\[(link|url)=(.*)\](.*)\[/(link|url)\],a
href=\\\2\ target=\_blank\\\3/a,$line);
$line = eregi_replace(\[color=(.*)](.*)\[/color\], font
color=\\\1\\\2/font, $line);
$line =
Checkout www.php.net/strtr
-Original Message-
From: Philip Murray [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 18, 2001 1:31 AM
To: PHP General List
Subject: [PHP] Regular expressions
In Perl you can do this:
$foo =~ tr/012/mpf/;
Which is the same as:
$foo =
Thanks Brian!
Very helpful. Is there a good website that covers Regular Expressions?
Jason
"Brian Clark" [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Hi Jason,
@ 1:43:19 AM on 4/20/2001, Jason Caldwell wrote:
...
I want to match any of the following:
Hi Jason,
@ 2:19:48 AM on 4/20/2001, Jason Caldwell wrote:
Thanks Brian!
No problemo.
Very helpful. Is there a good website that covers Regular Expressions?
There is a GNU Regular Expressions Document out there somewhere if you
want to know most of it inside an out (google.com will
I'm a little lost as to the exact function of the following:
^ and $
I noticed in the example below... that when I added the $ to the end of the
expression, I wasn't able anymore to put a non-alphanumeric character in the
end, for example (without the $)
I was able to enter the following and
Actually ordered that very book (earlier) tonight on Amazon. Looking
forward to getting it.
Thanks.
"Brian Clark" [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Hi Jason,
@ 2:19:48 AM on 4/20/2001, Jason Caldwell wrote:
Thanks Brian!
No problemo.
]
Subject: Re: [PHP] Regular Expressions?
I'm a little lost as to the exact function of the following:
^ and $
I noticed in the example below... that when I added the $ to the end of the
expression, I wasn't able anymore to put a non-alphanumeric character in the
end, for example (without the $)
I
On Fri, 20 Apr 2001 15:49, Jason Caldwell wrote:
Thanks Brian!
Very helpful. Is there a good website that covers Regular Expressions?
Jason
From my collection - there are duplicates^W^W^W. Heck, might as well tidy
this up. There aren't duplicates. Thanks to those who have variously
ant the start of
the string to match your expression...$ is used for the end of the
string...
-jack
-Original Message-
From: Jason Caldwell [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 20, 2001 2:41 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Regular Expressions?
I'm a little l
Hi Jason,
@ 2:40:34 AM on 4/20/2001, Jason Caldwell wrote:
I'm a little lost as to the exact function of the following:
^ and $
^ beginning of a string.
$ end of a string.
I noticed in the example below... that when I added the $ to the end of the
expression, I wasn't able anymore to put
Hi Jason,
@ 2:43:26 AM on 4/20/2001, Jason Caldwell wrote:
Actually ordered that very book (earlier) tonight on Amazon. Looking
forward to getting it.
It's likely to be one of the most valuable books you own.
-Brian
--
PGP is spoken here: 0xE4D0C7C8
Please, DO NOT carbon copy me on list
Brian --
Sorry if I seem dense. Your answer (although probably right on target)
leaves me still confused :-)
The example you gave me:
$string = '.';
print(eregi("^([[:alnum:]]+\.[[:alnum:]]+)", $string) ? 'matched' : 'no
match');
Now with your example (above) the following MATCHED
Hi Jason,
@ 3:08:06 AM on 4/20/2001, Jason Caldwell wrote:
Sorry if I seem dense. Your answer (although probably right on target)
leaves me still confused :-)
No problem at all.
The example you gave me:
$string = '.';
print(eregi("^([[:alnum:]]+\.[[:alnum:]]+)", $string) ?
I don't use ereg(i)? much myself but for a perl compat regex I would:
/^(([0-9a-z](\2*))\.([0-9a-z](\2*)))/i
the \# refer to parenthized matches starting at 1 and counting left parens.
The match array index you will want is $myArray[1].
if you don't mind matching
1a2.1a2 you can use
Maybe I'm wrong on this, but could this regex also be used like this?
if(eregi("^[a-zA-Z0-9]+\.[a-zA-Z0-9]+$", $myArray[x]))
--Chris
-Original Message-
From: Jason Caldwell [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 20, 2001 1:43 AM
To: [EMAIL PROTECTED]
Subject: [PHP]
Ahh It makes more sense now.
Thanks.
Jason
"Brian Clark" [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Hi Jason,
@ 3:08:06 AM on 4/20/2001, Jason Caldwell wrote:
Sorry if I seem dense. Your answer (although probably right on target)
leaves me
It seems good to me except there is an unbalanced '('...
-elias
http://www.kameelah.org/eassoft
""Jason Caldwell"" [EMAIL PROTECTED] wrote in message
9boi65$ipb$[EMAIL PROTECTED]">news:9boi65$ipb$[EMAIL PROTECTED]...
I'm looking to compare if my array values match any digits or alpha
Hi Jason,
@ 1:43:19 AM on 4/20/2001, Jason Caldwell wrote:
...
I want to match any of the following:
1.1 or a.a
or . or .-- any number of digits (0-9) or alpha (a-z)
on either side of the dot.
if(eregi("^([0-9][a-z]\.[0-9][a-z]", $myArray[x]))
Your parentheses are
101 - 200 of 200 matches
Mail list logo