Thanks to everyone who gave me examples, links and suggested alternatives
like explode(), but personally I thought explode too was a regex..:-(.
explode() is not, split() is.
-
michal migurski- contact info and pgp key:
sf/ca
Sorry last time I forgot to put subject on my mail. So here
I am putting appropriate subject and sending it.
Hi All,
Just wondering if somebody can help me with this small regex search.
The information I wanted to capture is the one in the Square Bracket.
i.e Date : 1/21/04, Race Type: 5-16,
I have tried numerous variations, but my regex skills suck! I would
appreciate anyone who can give me a pattern to use in preg_match_all() to
match the following (I have the first part up to ANYTHING working):
'|function ([\w\d\_]+)\((.*)\)ANYTHINGreturn (ANYTHING);|'
So parsing a PHP file I
I do not know if this is the right list, but if someone could help me with
the following
I need a function that does this:
function phone($num) {
take num and remove anything that is not a number
ex: () - /
If there is not 1 at the start, add a one to the start of the number.
make sure
Untested:
function fixhisnumber($str){
//remove all but numbers
$str = preg_replace(/[^0-9]/,,$str);
//append 1, unless it's already there
$str = $str[0] == '1'? $str:1.$str;
if (strlen($str) == 10) return $str;
else return -1;
}
Mohamed~
On Fri, 2003-10-10 at 14:01, Lists wrote:
I do not
I am trying to get a regex to extract the Some and more text
between the para elements below in a single pass for style attribute of
heading 2
para font-size=12 font-family=Arial style=heading 2Someanchor
type=bkmrk/more text-/para
para font-size=12 font-family=Arial style=heading 2inline
Message -
From: David Pratt [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, August 12, 2003 10:55 AM
Subject: [PHP] Regex help appreciated
I am trying to get a regex to extract the Some and
more text
between the para elements below in a single pass for
style attribute of
heading 2
Can't seem to get this to work...
trying to yank stuff xxx from
TD class=a8b noWrap align=middle width=17 bgColor=#ccxxx/TD
and stuff yyy from
TD class=a8b noWrap width=100nbsp;yyy/TD
preg_match(nbsp;(.*)/TD$|i, $l, $regs);
works for the second example, even though it isn't the correct
Can't seem to get this to work...
trying to yank stuff xxx from
TD class=a8b noWrap align=middle width=17 bgColor=#ccxxx/TD
and stuff yyy from
TD class=a8b noWrap width=100nbsp;yyy/TD
preg_match(|nbsp;(.*)/TD$|i, $l, $regs);
works for the second example, even though it isn't the correct
Hello,
This is a reply to an e-mail that you wrote on Mon, 21 Jul 2003 at
08:59, lines prefixed by '' were originally written by you.
Can't seem to get this to work...
trying to yank stuff xxx from
TD class=a8b noWrap align=middle width=17
bgColor=#ccxxx/td
Try this:
Hello,
Well I am doing by first reg ex operations and I am having problems which I just
cannot figure out.
For example I tried
echo eregi_replace (tr bgcolor=\#F8F8F1\(\s*)td\s*font
size=\2\\s*purchasing power parity, '%POWER%', 'tdtrsdsdsstr
bgcolor=#f8f8f1tdfont size=2Purchasing power
Sid [EMAIL PROTECTED] wrote:
Hello,
Well I am doing by first reg ex operations and I am having problems which I just
cannot figure out.
For example I tried
echo eregi_replace (tr bgcolor=\#F8F8F1\(\s*)td\s*font
size=\2\\s*purchasing power parity, '%POWER%', 'tdtrsdsdsstr
I have a string something like -
[TIT2] ABC [TPE1] GHI [TALB] XYZ
Im applying a regex as such -
// Title/Songname/Content
preg_match('/\[TIT2\](.*?)(\[)?/', $foo, $match);
$title = trim( $match[1] );
The above regex doesn't work. At the end of the pattern Im using (\[)?
The pattern may or may not
At 07:47 11.02.2003, Lord Loh. said:
[snip]
I am new to regex and broke my head on it the other day...in vain...
Can any one tell me a place to get a step by step tutorial on it or help me
out on how to work it out ?
This one time, at band camp,
Lord Loh. [EMAIL PROTECTED] wrote:
I am trying to make a link collector.
after opening the desired page, I want to get all the hyperlinks on it...
OK, this is quick and nasty, but you can add sanity/error checking etc
as you please, but it shows you the concept..
I am new to regex and broke my head on it the other day...in vain...
Can any one tell me a place to get a step by step tutorial on it or help me
out on how to work it out ?
I am trying to make a link collector.
after opening the desired page, I want to get all the hyperlinks on it...
Thank
Could someone show me how to use preg_replace to change this:
test OPTION VALUE=testtest/OPTION test
into:
anotherword OPTION VALUE=\test\test/OPTION anotherword
basically, I want to change a value only if it is not in an option
tag.
I also want to account for situations like :
test,
addslashes()
- Original Message -
From: Jim [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, December 19, 2002 11:26 AM
Subject: [PHP] Regex Help
Could someone show me how to use preg_replace to change this:
test OPTION VALUE=testtest/OPTION test
into:
anotherword OPTION
is to change 'test' into 'anotherword'
only if it is not within the option tag.
Thanks!
- Original Message -
From: Rick Emery [EMAIL PROTECTED]
To: Jim [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, December 19, 2002 12:42 PM
Subject: Re: [PHP] Regex Help
addslashes
, December 19, 2002 11:55 AM
Subject: Re: [PHP] Regex Help
I'm sorry, I accidentally left the slashes on my second example. My original
message should read:
Could someone show me how to use preg_replace to change this:
test OPTION VALUE=testtest/OPTION test
into:
anotherword OPTION VALUE
Subject: Re: [PHP] Regex Help
?php
$q = test OPTION VALUE=\test\test/OPTION test;
ereg((.*)(OPTION.*OPTION)(.*),$q,$ar);
$t = anotherword.$ar[2].anotherword;
print $t;
?
outputs:
anotherwordOPTION VALUE=testtest/OPTIONanotherword
--
PHP General Mailing List (http://www.php.net
]
To: [EMAIL PROTECTED]
Sent: Thursday, December 19, 2002 1:24 PM
Subject: Re: [PHP] Regex Help
Thanks for helping. Unfortunately, that doesn't quite accomplish the task
either. The other example for my first post would be mangled with that.
- Original Message -
From: Rick Emery [EMAIL
OPTION VALUE=testtest/OPTION anotherword
- Original Message -
From: Jim [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, December 19, 2002 12:25 PM
Subject: Re: [PHP] Regex Help
Whoops, sorry post aborted prematurely.
What I was going say say was that:
test, something OPTION VALUE
. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
-Original Message-
From: Jim [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 19, 2002 1:24 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Regex Help
Thanks
Instead of splitting the string on chars that don't equal \w and ',
split it on chars that equal \s (or any other you need)
Gerard Samuel wrote:
Im trying to explode a string into an array of words using -
$title = preg_split('/[^\w\']/', $title, -1, PREG_SPLIT_NO_EMPTY );
It seems to work
Im trying to explode a string into an array of words using -
$title = preg_split('/[^\w\']/', $title, -1, PREG_SPLIT_NO_EMPTY );
It seems to work well with words like this and don't but it doens't
work with words with accents to it like
Guantánamo
Could my regex be expanded to handle
Im trying to apply htmlspecialchars() to hrefs in a string.
Here is what I have.
?php
$str = 'hi bmy friend/b! br / this message uses html entities a
href=http://www.trini0.org;test/a!';
$str = preg_replace('/(a href=http:\/\/.*.*\/a)/',
htmlspecialchars($1), $str);
This is not really specific to PHP (although the information might be useful
for all that form validation we all do), and for that I apologize in advance
(does anyone know of a regex mailing list?), but maybe someone here can help
with the following:
I find no good regex for checking valid
I use this, but it's a preg rather than ereg pattern:
'/([a-z0-9]+[a-z0-9\-]*\.)+[a-z0-9]+[a-z0-9\-]*[a-z0-9]+$/i'
Two problems (which in practice are so slight that I've foregone my usual
standards-analness to ignore them)
1) It will allow a domain name component (except the final one)
Hello all
In the Apache config file, we have the following directive:
SetEnvIfNoCase Referer ^http://www.oursite.com/; local_ref=1
FilesMatch .(gif|jpg)
Order Allow,Deny
Allow from env=local_ref
/FilesMatch
We use this to prevent people from directly linking to .gif and .jpg files.
This
[mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 17, 2001 12:43 AM
To: [EMAIL PROTECTED]
Subject: [PHP] regex help
hi all,
a little OT here, but need some quick help. I have a bunch of e-mails to
convert into sql entries and I'm stuck here.
I have:
, John Doe, [EMAIL PROTECTED], ..
hi all,
a little OT here, but need some quick help. I have a bunch of e-mails to
convert into sql entries and I'm stuck here.
I have:
, John Doe, [EMAIL PROTECTED], ..
I just need to know what's the regex to switch around the name and e-mail
address.
TIA,
@lvin
--
PHP General
What exactly are you trying to do? Switch around in what way?
Jack
-Original Message-
From: Alvin Tan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 17, 2001 12:43 AM
To: [EMAIL PROTECTED]
Subject: [PHP] regex help
hi all,
a little OT here, but need some quick help. I have a bunch
I am trying to write a script that needs a list of all the images in an HTML file.
I am trying this code
if (eregi ((img.+src=)(.+)[\s],$buffer, $regs ))
{
echo $regs[2]BRBR;
}
The problem, however is that when it looks at
IMG SRC=images/Logo.gif ALT=Only Child Club - The
into
the ().
- e r i c k
-Original Message-
From: Sheridan Saint-Michel [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 13, 2001 9:04 AM
To: [EMAIL PROTECTED]
Subject:[PHP] Regex Help
I am trying to write a script that needs a list of all the images in an HTML
file.
I am trying
On Friday 30 March 2001 06:47, you wrote:
Ok, i have a text file with lines that looks like this:
14```value```value2`value3
This would be fine, except...there are sometimes more than in
other columns, so id like it to be
14``value``value2``value3
$new = preg_replace ('/`+/',
So as you seem to be good with regexps, can you tell me how i can write a
code that will search for next occurence in a string?
where pattern is a regexp and a string is long and ofcourse there will be
lots of pattern matchs in it...?
thanks
"Christian Reiniger" [EMAIL PROTECTED] wrote in
On Saturday 31 March 2001 00:07, you wrote:
So as you seem to be good with regexps, can you tell me how i can write
a code that will search for next occurence in a string?
where pattern is a regexp and a string is long and ofcourse there will
be lots of pattern matchs in it...?
What about
Ok, i have a text file with lines that looks like this:
14```value```value2`value3
This would be fine, except...there are sometimes more than in other
columns, so id like it to be
14``value``value2``value3
So I can explode() it into a mysql database. Can anyone offer a regexp for
It's a lame way, but it works,
I sure hope that someone can tell me how to do it in pure regexp.
like how can i 'search for next occurence' in ereg or any regexp() in PHP
-
?
$str = "14```value```value2`value3``hehe!``hohoho";
while ( ereg("[^`]+", $str, $result) )
{
$match =
how do I select the first space after some alpha-numeric characters?
I can ^\D\s to get the characters and the space, but how can I select
the space only?
Jerry Lake- [EMAIL PROTECTED]
Web Designer
Europa Communications - http://www.europa.com
Pacifier Online -
Hello,
I need to take a string and remove everything from the first "" character
to the end of the line. I'm pretty sure I could do this with an
ereg_replace(), but I am horrible at regular expressions. Could anyone help
me with this?
- John Vandebreck
- Admin, GameDesign
--
PHP General
On Friday 23 February 2001 19:33, John Vanderbeck wrote:
I need to take a string and remove everything from the first ""
character to the end of the line. I'm pretty sure I could do this with
an ereg_replace(), but I am horrible at regular expressions. Could
anyone help me with this?
r
PHPBeginner.com (Where PHP Begins)
[EMAIL PROTECTED]
www.phpbeginner.com
-Original Message-
From: Jesse Swensen [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 13, 2001 4:39 AM
To: PHPBeginner.com
Subject: Re: [PHP] Regex help needed...
Thank you for your suggest, but I don't
This should be a quick one, but I can't seem to wrap my brain around it.
All I need to do is replace leading or trailing spaces with underscores. If
there is spaces in between words, leave them alone.
Suggestions?
--
Jesse Swensen
[EMAIL PROTECTED]
--
PHP General Mailing List
On Mon, Feb 12, 2001 at 12:15:04PM -0500, Jesse Swensen wrote:
This should be a quick one, but I can't seem to wrap my brain around it.
All I need to do is replace leading or trailing spaces with underscores. If
there is spaces in between words, leave them alone.
$fix = ereg_replace("(^ )|(
PROTECTED]
Subject: [PHP] Regex help needed...
This should be a quick one, but I can't seem to wrap my brain around it.
All I need to do is replace leading or trailing spaces with underscores. If
there is spaces in between words, leave them alone.
Suggestions?
--
Jesse Swensen
[EMAIL PROTECTED
on 2/12/01 1:01 PM, Jason Stechschulte at [EMAIL PROTECTED] wrote:
On Mon, Feb 12, 2001 at 12:15:04PM -0500, Jesse Swensen wrote:
This should be a quick one, but I can't seem to wrap my brain around it.
All I need to do is replace leading or trailing spaces with underscores. If
there is
This is very close. If the string, " Testing ", had multiple spaces, but
I wanted to convert each space to a "_", then what? I tried:
There may be a better way, but here is a lengthy one that works.
$checkme = " this is it ";
if(ereg("^( )+", $checkme,
on 2/12/01 4:30 PM, Christian Reiniger at [EMAIL PROTECTED] wrote:
On Monday 12 February 2001 21:08, Jesse Swensen wrote:
This should be a quick one, but I can't seem to wrap my brain around
it. All I need to do is replace leading or trailing spaces with
underscores. If there is spaces in
101 - 150 of 150 matches
Mail list logo