Why is it taking the char before the [^\r] also?
-Josh
On Thu, 1 Jul 2004 15:17:04 -0700, Justin Patrin [EMAIL PROTECTED] wrote:
On Thu, 1 Jul 2004 16:41:50 -0500, Josh Close [EMAIL PROTECTED] wrote:
I'm trying to get a simple regex to work. Here is the test script I have.
* Thus wrote Justin Patrin:
On Thu, 1 Jul 2004 16:41:50 -0500, Josh Close [EMAIL PROTECTED] wrote:
I'm trying to get a simple regex to work. Here is the test script I have.
#!/usr/bin/php -q
?
$string = hello\nworld\n;
$string = preg_replace(/[^\r]\n/i,\r\n,$string);
$string
* Thus wrote hitek ([EMAIL PROTECTED]):
Greetings list,
I have been given a list of products, and I need some help building a
regular expression to split the category from the sub category.
Example:
CamerasDigital_CannonXLRshot -Original entry in list
Cameras Digital Cannon XLRshot
Curt,
That's perfect. Works like a charm.
Thanks,
Keith
At 03:54 PM 5/10/2004, Curt Zirzow wrote:
* Thus wrote hitek ([EMAIL PROTECTED]):
Greetings list,
I have been given a list of products, and I need some help building a
regular expression to split the category from the sub category.
preg_match( #39-([0-9]{8})# , $source , $result );
Brent Clark wrote:
Hi all
does anyone know of a regex expression to get only the number number from after the Code 39
Kind Regards
Brent Clark
1 barcodes found Code 39-10005215
This is the search1 barcodes found 2 barcodes found Code
Brent Clark wrote:
Hi all
does anyone know of a regex expression to get only the number number from after the Code 39
Kind Regards
Brent Clark
1 barcodes found Code 39-10005215
$barcodes = Code 39-10005216;
$parts = explode(,$barcodes);
echo Number is .$parts[1];
Might be faster.
--
PHP
Faster, but wrong. Take a look at his question and examples.
Burhan Khalid wrote:
Brent Clark wrote:
Hi all
does anyone know of a regex expression to get only the number number
from after the Code 39
Kind Regards
Brent Clark
1 barcodes found Code 39-10005215
$barcodes = Code 39-10005216;
From: Burhan Khalid [EMAIL PROTECTED]
Brent Clark wrote:
Hi all
does anyone know of a regex expression to get only the number number
from after the Code 39
Kind Regards
Brent Clark
1 barcodes found Code 39-10005215
$barcodes = Code 39-10005216;
$parts = explode(,$barcodes);
Just thought I'd throw this amazing tool out there as I just discovered it
too:
http://www.weitz.de/regex-coach/
Windows and linux versions for free!
-Original Message-
From: Brent Clark [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 31, 2004 7:29 AM
To: [EMAIL PROTECTED]
Sorry I to should have added this this is what im going with so far
preg_match(/\d100.*/);
This will match a digit, followed by '100', followed by anything.
Go with Rob's suggestion.
-
michal migurski- contact info and pgp key:
Hello Brent,
Tuesday, March 16, 2004, 12:39:27 PM, you wrote:
BC im in desperate need of help for a reg expression to ONLY allow 8
BC NUMBERS to start with 100 and may not have any other kind of
BC letters or characters. Only numbers
BC for example
BC 10064893
It's not a reg exp, but it will
On Tue, Mar 16, 2004 at 02:39:27PM +0200, Brent Clark wrote:
Hi there
im in desperate need of help for a reg expression to ONLY allow 8 NUMBERS to start
with 100 and may not have any other kind of
letters or characters. Only numbers
for example
10064893
if
On 03/16/2004 6:57 AM, Rob Ellis [EMAIL PROTECTED] wrote:
On Tue, Mar 16, 2004 at 02:39:27PM +0200, Brent Clark wrote:
Hi there
im in desperate need of help for a reg expression to ONLY allow 8 NUMBERS to
start with 100 and may not have any other kind of
letters or characters. Only
Ryan A mailto:[EMAIL PROTECTED]
on Monday, March 15, 2004 9:07 AM said:
I know this is pretty easy to do but I am horrorable at working with
regular expressions and was wondering if anybody might take a min to
help please.
in that case you should get the regex coach (easy to find via
On Tuesday 16 March 2004 01:06, Ryan A wrote:
I know this is pretty easy to do but I am horrorable at working with
regular expressions and was wondering if anybody might take a min to help
please.
I will have a variable: $the_extention
which will have a value like:
I will have a variable: $the_extention which will have a value like:
98797-234234--2c-something-2c
How do I take out the part which will always start with --2c and will
always end with -2c
You could use preg_replaces, like so:
$result = preg_replace('/--2c.+-c/', '', $the_extention);
At 6:06 PM +0100 3/15/04, Ryan A wrote:
I know this is pretty easy to do but I am horrorable at working with regular
expressions and was wondering if anybody might take a min to help please.
I will have a variable: $the_extention
which will have a value like:98797-234234--2c-something-2c
How
Hey,
Thanks guys.
I did search on google first for a tutorial, problem is with something as
widely used as regular expressions
there are LOTS of results...I felt it would be better to ask if anyone has a
favourite..
ie:
if you learnt it off the web and not via the manual.
The last time I had
On 15 Mar 2004 Eric Gorr wrote:
which will have a value like:98797-234234--2c-something-2c
How do I take out the part which will always start with --2c and will
always end with -2c
I'd be interested in the answer to this question as well.
Seems like it should be easy.
It is easy.
Hey Guys,
Solved this, took your advise and avoided regex as its an overkill.
Case you're interested:
$th_var=98797-234234--2c-something-2c;
$piece = explode(--2, $th_var);
echo $piece[0];
(and if i want to use the second part... $piece[1] )
Thanks to everyone who gave me examples, links and
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
Hello Adam,
Thursday, March 4, 2004, 3:36:06 PM, you wrote:
AW What would be the PHP expression to change any and all ' to ? in a
AW variable?
AW I want to change any and all ' in $_POST[data] to ?
$output_array = str_replace(', ?, $_POST);
Use this instead of a reg exp for such a simple
Thank you, that works great!
On Thu, 4 Mar 2004, Richard Davey wrote:
Hello Adam,
Thursday, March 4, 2004, 3:36:06 PM, you wrote:
AW What would be the PHP expression to change any and all ' to ? in a
AW variable?
AW I want to change any and all ' in $_POST[data] to ?
$output_array
if(preg_match('/img[^]+src[ ]*=[ ]*(||\')[a-z]{1}:\\\/i', $string))
echo local links used;
[EMAIL PROTECTED] wrote:
My regex skills are serious lacking and after scouring the net for
relevant links I'm a bit stuck. I've got a textarea field where I pull
user input from, and I'd like to search
My regex skills are serious lacking and after scouring the net for
relevant links I'm a bit stuck. I've got a textarea field where I pull
user input from, and I'd like to search this entire field for a Windows
Directory Path (ex. C:\Documents\Blah).
if(preg_match('/img[^]+src[ ]*=[
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
On 01 October 2003 21:02, [EMAIL PROTECTED] wrote:
1. The PHP manual sais to escape the escape char, it has to
be written
twice*, but:
Yes, it does. But it also says that to put a \ into a string, you need to
write it twice (escape it) ***. So:
$term = preg_replace('/(\\)/', 'backslash
Ooops, forgot the footnote:
***
http://www.php.net/manual/en/language.types.string.php#language.types.string
.syntax
Cheers!
Mike
-
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning
You can escape the control characters manualy ;)
$termWithOptionalBold=str_replace(array('.','\','$'
),array('\.','\\','\$' ), $termWithOptionalBold);
[EMAIL PROTECTED] wrote:
Regular Expressions: How can I indicate that the contents of a term
(user input*) needs to be treated as
From: [EMAIL PROTECTED]
Regular Expressions: How can I indicate that the contents of a term
(user input*) needs to be treated as 'non-operators/control characters'
(as *word* to match in that exact way)?
(* Because the term is a user's input I can't escape the control
characters
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
on Wednesday, October 01, 2003 1:02 PM said:
Does this make ANY sense?
Seeing as how you haven't had a response yet, I'll ask this: what
exactly is your question? I'm not sure as to what it is that you want.
c.
--
PHP General Mailing List
Am Mittwoch, 01.10.03 um 22:27 Uhr schrieb Chris W. Parker:
Seeing as how you haven't had a response yet, I'll ask this: what
exactly is your question? I'm not sure as to what it is that you want.
My question are:
a) Why does the PHP manual say that backslashes get escaped by writing
them twice
* Thus wrote jonas_weber @ gmx. ch ([EMAIL PROTECTED]):
Am Mittwoch, 01.10.03 um 22:27 Uhr schrieb Chris W. Parker:
Seeing as how you haven't had a response yet, I'll ask this: what
exactly is your question? I'm not sure as to what it is that you want.
My question are:
a) Why does the PHP
On 15 August 2003 12:02, Merlin wrote:
Hi there,
I have a regex problem.
Basicly I do not want to match:
/dir/test/contact.html
But I do want to match:
/test/contact.html
I tryed this one:
^[!dir]/(.*)/contact(.*).html$
Well, that's not going to work because the construct
nop.. that does not work either.
It does not execute for a url like: /test/contact.html
The regex should execute for
/test/contact.html
but not for /partner/test/contact.html
where test should be open for any word
Any other suggestions? I am sure this is possible.
Merlin
-- arek Kilimajer
try
RewriteRule ^!partner/([^/]*)/contact([\.]*).html$ profiles?modrew_fa=6
Merlin wrote:
Hi there,
I am having trouble with a reg ex.
What it should do is, terminate if the url is /*/contact.html
but it should not terminate if it is /partner/*/contact.html
where * stands for any value
I
Firstly,
If your text spans more than one line you should use
\n, rather than just doing something like :
a href=\
hello\...(.*)/a
because that will mess up, depending on what text
editor you use, eg. notepad will put \r\n, but it
should only be \n. Though I'm not sure about it.
So the best
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:
Gerard Samuel [EMAIL PROTECTED] wrote:
Has anyone had any success with using variables in a regex shown below??
$foo = 3;
$bar = 4;
preg_match('/^[a-z0-9\-_\.]+\.[a-z0-9]{$foo, $bar}$/', $some_string)
You have single quotes, so php wont expand the variables inside.
or even
Curt Zirzow wrote:
Gerard Samuel [EMAIL PROTECTED] wrote:
or even
preg_match('/^[a-z0-9\-_\.]+\.[a-z0-9]{' . $foo . ', ' . $bar . '}$/',
$some_string)
that should work.
Unfortunately it doesn't for some reason. Don't know why.
but you could do this:
$pattern =
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
Gerard Samuel a écrit:
Curt Zirzow wrote:
Gerard Samuel [EMAIL PROTECTED] wrote:
or even
preg_match('/^[a-z0-9\-_\.]+\.[a-z0-9]{' . $foo . ', ' . $bar .
'}$/', $some_string)
I think, you Forgot, a \ before the $ at the end of the expression...
that should work.
Unfortunately it doesn't
On 17-Jun-2003 Ron Dyck wrote:
I need to match text between two html comment tags.
I'm using: preg_match(/!--start_tag--(.*)!--end_tag--/, $data,
$Match)
Which work fine until I have carriage returns. The following doesn't
match:
Use the m (multiline) modifier:
Hello
Two things:
First wouldn't it be faster to use strpos and substr if you simply have to
find the literate !-- start_tag -- and !-- end_tag --.
Second: If you use your regex and you have something like
!-- start_tag -- This is some text to grasp!-- end_tag -- this is
text I don't want !--
. matches any character except newline by default, use s modifier:
preg_match(/!--start_tag--(.*)!--end_tag--/s, $data, $Match)
Ron Dyck wrote:
I need to match text between two html comment tags.
I'm using: preg_match(/!--start_tag--(.*)!--end_tag--/, $data, $Match)
Which work fine until I have
Are you wanting the $_POST['nums1'] to have only numbers, -, ., #, :
Is this what you are trying to match. if so, try this.
if ( preg_match(/[^0-9\#\:\.\-]/, $_POST['nums1']) ) {
throw error()
}
This will match anything that is not a number or one of the other special
chars that are in
: Saturday, May 31, 2003 6:04 PM
Subject: Re: [PHP] regex problem
Are you wanting the $_POST['nums1'] to have only numbers, -, ., #, :
Is this what you are trying to match. if so, try this.
if ( preg_match(/[^0-9\#\:\.\-]/, $_POST['nums1']) ) {
throw error()
}
This will match
Try this (entirely untested!):
$final_footer =
preg_replace('%INCLUDE_FILE\\[[^\\]]*\\]%','',$final_footer);
Nate wrote:
hi,
i need to search $final_footer for a string such as
%INCLUDE_FILE[/path/to/file]% (where /path/to/file could be anything) and
delete it from the string. it being
Thanks! That worked almost. It removed everything except for the 2 %
signs.
How might I remove those as well?
Leif K-Brooks [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...
Try this (entirely untested!):
$final_footer =
preg_replace('%INCLUDE_FILE\\[[^\\]]*\\]%','',$final_footer);
Thanks! That worked almost. It removed everything except for the 2 %
signs.
How might I remove those as well?
Leif K-Brooks [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Try this (entirely untested!):
$final_footer =
preg_replace('%INCLUDE_FILE\\[[^\\]]*\\]%','',$final_footer);
Whoops! Try this:
preg_replace('|%INCLUDE_FILE\\[[^\\]]*\\]%|','',$final_footer);
Nate Sanden wrote:
Thanks! That worked almost. It removed everything except for the 2 %
signs.
How might I remove those as well?
Leif K-Brooks [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Try
Worked great. Thanks so much.
Leif K-Brooks [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Whoops! Try this:
preg_replace('|%INCLUDE_FILE\\[[^\\]]*\\]%|','',$final_footer);
Nate Sanden wrote:
Thanks! That worked almost. It removed everything except for the 2 %
signs.
How
suppose there's a string
$string=I like my(hot) coffee with sugar and (milk)(PHP);
I would like to get an output of all possible combinations of the
sentence
with the words between brackets:
eg.
I like my hot coffee with sugar and
I like my hot coffee with sugar and milk
I like my hot
suppose there's a string
$string=I like my(hot) coffee with sugar and (milk)(PHP);
I would like to get an output of all possible combinations of the sentence
with the words between brackets:
eg.
I like my hot coffee with sugar and
I like my hot coffee with sugar and milk
I like my hot
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 have to check if there's a dot in a string, and i need nothing but the
regex pattern for this... tryed a lot, but the dot itself means to matches
all.
you can read a little and not very clear introduction here:
http://nl.php.net/manual/nl/pcre.pattern.modifiers.php
and
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
Troy May wrote:
How would take a regular non-formatted text link (http://www.link.com) and
turn it into ready to post HTML? (a
href=http://www.link.comhttp://www.link.com/a)
Darn, Outlook formats it, but you get the idea. It would just be typed out
normally.
Any ideas?
function MakeUrl
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
Hello,
Leif K-Brooks [EMAIL PROTECTED] wrote:
[snip]
But that doesn't work at all. Any ideas on how to do this?
[/snip]
Would't it be easier (and faster) to use
http://www.php.net/manual/en/function.str-replace.php ?
- E
--
PHP General Mailing List (http://www.php.net/)
To
I need to do a few other things that require regex though, like making
either an a or an @ match (people love to get around filters by using
symbols instead of letters...).
@ Edwin wrote:
Hello,
Leif K-Brooks [EMAIL PROTECTED] wrote:
[snip]
But that doesn't work at all. Any ideas on how
To Match: Tue, Jul 29, 2003
$pregmatchstring=/([\s])*(Renewal\DDate|Registered\sthrough|Expires|Record
\sExp ires|Domain\sExpires|Expiry\sDate)([\D\s]*)(.*)/i;
You can change the last part of $pregmatchstring in:
Expiry\sDate)([\D\s]*|\w{3},\s\w{3}\s\d{2},\s\d{4})(.*)/i;
You can feed
On Sat, Aug 03, 2002 at 05:03:36PM +0100, Phil Ewington wrote:
Hi,
I am am writing a function to color code and indent JavaScript source using
regular expressions and cannot seem to get back referencing working.
What you're using isn't back referencing, it's utilizing substrings.
Back
try
\\1
- Original Message -
From: Phil Ewington [EMAIL PROTECTED]
To: PHP General [EMAIL PROTECTED]
Sent: Saturday, August 03, 2002 5:03 PM
Subject: [PHP] RegEx (back referencing)
Hi,
I am am writing a function to color code and indent JavaScript source
using
regular expressions
- not perfect, but a start.
Danny.
- Original Message -
From: Phil Ewington [EMAIL PROTECTED]
To: Danny Shepherd [EMAIL PROTECTED]
Sent: Saturday, August 03, 2002 5:52 PM
Subject: RE: [PHP] RegEx (back referencing)
\\1 outputs nothing at all wrapped in font tags and closing tags \ wrapped
What's strange is that doing an ord($string) returns 171, which is a '1/2'
char. So why does PHP convert the pattern match??
-Original Message-
From: Phil Ewington [mailto:[EMAIL PROTECTED]]
Sent: 03 August 2002 17:04
To: PHP General
Subject: [PHP] RegEx (back referencing)
Hi,
Danny,
It still doesn't work, could this be a problem in 4.0.4pl1 ??
-Original Message-
From: Danny Shepherd [mailto:[EMAIL PROTECTED]]
Sent: 03 August 2002 18:11
To: [EMAIL PROTECTED]; PHP-General
Subject: Re: [PHP] RegEx (back referencing)
If you're trying to get scriptLots
PM
Subject: RE: [PHP] RegEx (back referencing)
Danny,
It still doesn't work, could this be a problem in 4.0.4pl1 ??
-Original Message-
From: Danny Shepherd [mailto:[EMAIL PROTECTED]]
Sent: 03 August 2002 18:11
To: [EMAIL PROTECTED]; PHP-General
Subject: Re: [PHP] RegEx
PROTECTED]
Sent: Saturday, August 03, 2002 8:54 PM
Subject: RE: [PHP] RegEx (back referencing)
Danny,
OK, the input string is the contents of a file, the idea is to output
color
coded and indented code in HTML. So searching for script and replace
with
font color=maroonscript/font, so
On Sun, Jul 28, 2002 at 04:02:32PM -0400, Mike Mannakee wrote:
Does anyone have a regular expression that works to validate credit card
numbers?
http://www.analysisandsolutions.com/code/ccvs-ph.htm
I just updated it to Version 4.3 LATE Friday night. So, anyone using
anything earlier than
other than each'ing an array and performing a regex match, is there an easier
way to parse through the values in an array for a value matching
*something*somethingelse*
No, I don't believe so. But I'm sure you can set up something to use with
array_walk().
Chris
--
PHP General Mailing
Hi Roger
Try this:
$str = sometext sometext [emoticon01] sometext [emoticon23] sometext;
$new_str = preg_replace(/\[emoticon(\d\d)\]/, /image/emot/\\1.gif,
$str);
print $new_str;
Seems to work?
Rgds
John
- Original Message -
From: Roger Thomas [EMAIL PROTECTED]
To: [EMAIL
yeeaHAH ! great. Thanks John.
think i'll never regret joining the list.
--
roger
--- John Legg [EMAIL PROTECTED] wrote:
Hi Roger
Try this:
$str = sometext sometext [emoticon01] sometext [emoticon23] sometext;
$new_str = preg_replace(/\[emoticon(\d\d)\]/, /image/emot/\\1.gif,
$str);
Actually for a job like this look to substr() to extract the last three
chars as a string and compare them in an if() statment.
http://www.php.net/manual/en/function.substr.php
-Kevin
- Original Message -
From: David Busby [EMAIL PROTECTED]
To: php-general [EMAIL PROTECTED]
Sent:
$string = 'somethingphp';
$pat = 'php$';
$hasphp = ereg($pat, $string);
Henning Sittler
www.inscriber.com
-Original Message-
From: David Busby [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 02, 2002 4:49 PM
To: php-general
Subject: [PHP] RegEx question
List,
How can I
eregi(php$, $stringtobecompared);
See: http://www.php.net/manual/en/ref.regex.php
Gurhan
- Original Message -
From: David Busby [EMAIL PROTECTED]
To: php-general [EMAIL PROTECTED]
Sent: Tuesday, July 02, 2002 4:49 PM
Subject: [PHP] RegEx question
List,
How can I regex to compare
Well Ive gotten
(.*)
and
([a-z]*[0-9]*_*-*)
to work thus far as the first group.
I would like to avoid option 1, and option 2 doesn't seem right
Gerard Samuel wrote:
Im expecting a string like foo.png.
Im trying to replace 'foo' with another value that I have.
Im trying this -
$file
$file = preg_replace('/^([a-z0-9\-\_]*).([a-z]{3,4})$/i', $new_file .
.$2, $_FILES['upload']['name']);
Maybe this?
Jim Lucas
- Original Message -
From: Gerard Samuel [EMAIL PROTECTED]
To: PHP [EMAIL PROTECTED]
Sent: Tuesday, June 11, 2002 3:11 PM
Subject: [PHP] regex
Im expecting a
On Mon, Jun 03, 2002 at 11:15:15AM -0600, Jas wrote:
In order to view the contents of the file in the
text area I had to setup a eregi_replace(,a) string.
's are not legal in HTML. You need to escape them. When pulling stuff
out of the file, use htmlspecialchars() before displaying the
This should work for most cases:
function strip_key($key, $string)
{
$string = preg_replace(/(|\?)($key=(\w+)?)(?)/, '$1', $string);
return preg_replace('/(\?|)$/', '', $string);
}
print strip_key(list, yadda?bo=ralist=XXXtwo=three);
print strip_key(list, yadda?bo=ralist=two=three);
print
this is what I use to get rid of line from the url
$qs = ereg_replace($, , ereg_replace(line=[^]*?, ,
$QUERY_STRING));
HTH
MArtin
-Original Message-
From: Scott Reismanis [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 28, 2002 12:00 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Regex
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)
Show some code...
Thanks,
Ray BigDog Hunter
-Original Message-
From: kras [mailto:[EMAIL PROTECTED]]
Sent: Sunday, May 19, 2002 9:53 AM
To: [EMAIL PROTECTED]
Subject: [PHP] regex: string begins with NEITER http NOR cid NOR mailto
Hello!
I have got a big problem:
I have html
There you are
$html = preg_replace ('href=(\|)(?!mailto)([.]*?[^\]*?)(\|
)'si, href=\.$bejsnejm.\\2\, $html);
$html = preg_replace
('(src|background|href)=(\|)(?!http)([.]*?[^\]*?)(\| )'si,
\\1=\.$bejsnejm./\\3\, $html);
of course it fails.
kras
Show some code...
Thanks,
Ray
I figured it out. Change the last line to
echo htmlspecialchars($b);
and you'll get the proper output.
Gerard Samuel wrote:
Im trying to get a final output to be 'item' but Im unable to get
working. Could someone point me where Im going wrong.
Thanks
?php
$a = 'item
Boaz Yahav a écrit :
When i try to use preg_match on strings that have ? inside them it
seems to not work.
Any ideas how to bypass this?
thanks
berber
--
Marius Ursache (3563 || 3494)
\|/ \|/
'/ ,. \`
use \? instead of ?
Boaz Yahav a écrit :
When i try to use preg_match on strings that have ? inside them it
seems to not work.
Any ideas how to bypass this?
thanks
berber
--
Marius Ursache (3563 || 3494)
\|/ \|/
'/ ,. \`
Good day,
Just off the top of my head, try:
/.+\@.*([^\.]*\.[^\.]*)$/
Might not have the exact syntax, but, you get the idea.
Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948
On Mon, 22 Apr 2002, James Taylor wrote:
I'm trying to come up with a regular expression that will match the TL
and Second Level domain names in someone's email address ONLY.
Whatever you're planning on doing with that, I hope you're ready for
addresses that end with .ac.uk and so on; trying
Why not just limit it to one br?
?php
$string=blahbrbrbrbrbrbrbrbrbrstuff;
while ( stristr($string, 'brbr') ) {
$string=str_replace('brbr', 'br', $string);
}
echo $string;
?
something like that would wok well enough...
-Original Message-
I don't have that much experience with preg* functions but if that's exactly
how you've got it in your code, shouldn't there be no spaces??
that is:
preg_match(/http:\/\/ | [[:space:]]/i,$valToEval);
* *
\-\both of these should be removed ?
preg syntax is different to ereg (which you are using). You also need to
provide an output variable.
This would work:
preg_match( /[0-9]+/, $input, $output );
--
Matt
Carl E Shmidt [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Now I'm looking to find 1 or
Maybe this can help :
pick up an array of variables from a query string such as:
http://www.archipro.com/test.php?state=ABstate=BC
http://www.weberdev.com/index.php3?GoTo=get_example.php3?count=3265
Sincerely
berber
Visit http://www.weberdev.com Today!!!
To see where PHP might take
401 - 500 of 564 matches
Mail list logo