$regs is an array not a string !
try print_r or var_dump to determine $regexp's content
Tim Van Wassenhove wrote:
In article <[EMAIL PROTECTED]>, Bruce wrote:
$file = ".txt";
ereg("(\.)([a-z0-9]{3,5})$", $file, $regs);
echo " ww = ".$regs. "";
i'm trying to figure out how to get the portion of
In article <[EMAIL PROTECTED]>, Bruce wrote:
> $file = ".txt";
>
> ereg("(\.)([a-z0-9]{3,5})$", $file, $regs);
> echo " ww = ".$regs. "";
>
>
> i'm trying to figure out how to get the portion of the regex that's the
> "extension" of the file. my understanding of the docs, says that the
> "ex
* Thus wrote Jeff McKeon ([EMAIL PROTECTED]):
>
> >
> > preg_match_all('($-?[0-9]+\.[0-9]+)', $string, $found);
> > print_r($found);
> >
>
> That produces:
>
> Array ( [0] => Array ( ) ) 0 , Array
Sorry that should be:
preg_match_all('/(\$-?[0-9]+\.[0-9]+)/', $string, $found);
Curt
--
> -Original Message-
> From: Curt Zirzow [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 25, 2004 6:55 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: Ereg problems
>
>
> On Thu, 25 Mar 2004 18:31:02 -0500, Jeff McKeon
> <[EMAIL PROTECTED]>
> wro
On Thu, 25 Mar 2004 18:31:02 -0500, Jeff McKeon <[EMAIL PROTECTED]>
wrote:
Having some problems with ereg()
[begin code]
$string="Credit adjusted: $-1.32 to $48.68"
ereg("([\\$(\\$-)][0-9]+\.[0-9]+)",$data[2],$found);
While(list($index,$hits)=each($found))
it works if you remove the last $ from the expression, also I think the
. needs escaping
unless you have a special reason, use preeg_* as it is supposed to be
quicker
Mike
Manuel Ochoa wrote:
Why is this test failing?
$data = "A Simple test.";
If (ereg("^[a-zA-Z0-9\s.\-_']+$", $data)) {
ec
I think this is a lot more complicated than somethign a simple regular
expression can handle.
You would need to do soemthign that reads the entire file, up until the
first occurrence of your '//'
and in the meantime do a count that checks to make sure all the quotes are
closed.
I'd be interested
Notice the ?... The ? after the * is at least supposed to stop that
problem... So preg_replace("#\{(.*?),(.*?)\}#","\\2",$whatever); should do what you want...
:p
--
// DvDmanDT
MSN: [EMAIL PROTECTED]
Mail: [EMAIL PROTECTED]
"Ivo Fokkema" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTEC
* Thus wrote Ivo Fokkema ([EMAIL PROTECTED]):
> Well d*mn, why didn't I think of this... It seems to work now! Thanks!
>
> I'm not such an expert on the Perl compatible regexp's so I rarely use
> them... Yet another reason to start using them though...
Its a good thing to learn perl regular expre
Well, I tried that first, but it failed when some user whould list multiple
references. The ereg_replace would then take the two references as one.
"{PMID11519736:Müller}, {PMID8789442:Milasin}" would result in a link to
Müller named "Müller}, {PMID8789442:Milasin" instead of two separate
links...
Also... You know, there's a (.*?) command as well.. Might work just about
perfect in your situation...
--
// DvDmanDT
MSN: [EMAIL PROTECTED]
Mail: [EMAIL PROTECTED]
"Ivo Fokkema" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTECTED]
> Well d*mn, why didn't I think of this... It seems to
What? Did it seriously help?
You might be intrested in this regex then:
preg_replace("#[a-z0-9\-\._îÎèéüÜÉÈáàÁÀäÄåÅöÖ]+#i",'',$VARIABLE);
// Should hit most chars you want...
--
// DvDmanDT
MSN: [EMAIL PROTECTED]
Mail: [EMAIL PROTECTED]
"Ivo Fokkema" <[EMAIL PROTECTED]> skrev i meddelandet
news:
Well d*mn, why didn't I think of this... It seems to work now! Thanks!
I'm not such an expert on the Perl compatible regexp's so I rarely use
them... Yet another reason to start using them though...
Thanx!
"Dvdmandt" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Use preg_*() func
Use preg_*() functions then? Not that I think they would be much better
but...
--
// DvDmanDT
MSN: [EMAIL PROTECTED]
Mail: [EMAIL PROTECTED]
"Ivo Fokkema" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTECTED]
> Hi list,
>
> I read through the manual and tried to find something on google,
<>
.
.
.
<>
The problem with this is that I need to do it at the
Linux level, or else I'm not saving PHP the trouble of
searching through every file to find it.
__
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting
or.. if there can be only one instance of the number you can easily calculate it's
position with
strlen($numbers)
and strpos($numbers, "1");
if strlen returns 5 and strpos 5 you'll know it was far right.. if strpos returns 1
and strlen >1 it's to the left.. and if strpos < strlen but not 1 it'
hi,
this is probably not at all what you want, but i wrote it just in case.
if 1 is in the string it will return either "middle", "left", "right" or "only".. if
it is not it will return false.
On Fri, 15 Nov 2002 08:49:23 -0800 (PST)
[EMAIL PROTECTED] (Mako Shark) wrote:
>I have a real proble
> "William Glenn" <[EMAIL PROTECTED]> wrote in message
news:003101c27c3b$ff8c61a0$6401a8c0@;cortez.co.charter.net...
> Hey all,
> I've been fighting this all night, I need a bit of help. I have a string
like.
>
> #21-935 Item Description: $35.95
>
> Where the part # could be 10-2034 a combination
ject: [PHP] Re: ereg size limit???
Hi,
"Sp" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I am trying to validate my input with ereg but I get the error "Warning:
> REG_BADBR" when I try over 255 characters. Is ther
Hi,
"Sp" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I am trying to validate my input with ereg but I get the error "Warning:
> REG_BADBR" when I try over 255 characters. Is there anyway around this?
>
> Works
> =
> if(eregi('^[A-Za-z]{1,255}$', "test
thanks to all of you for you help.
regards
Laurent
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
If you look on php.net and run a search on ereg() you will find examples on
how to use regex. Your string would look like this:
ereg('[a-z][A-Z][0-9]{7}')
With your special characters I am not sure how that would work but check out
php.net.
hth
Jas
--
PHP General Mailing List (http://www.php.
On Wed, 2002-01-30 at 08:16, liljim wrote:
> Hi Bart,
>
> > I want to check the data from a form-field if it excists only of digits
> > (0-9) and nothing else.
> >
> > How do I use the ereg()-function for this?
>
> Well, I prefer the preg_functions
>
> if (!preg_match("/^[0-9]{10}$/", $string))
Hi Bart,
> I want to check the data from a form-field if it excists only of digits
> (0-9) and nothing else.
>
> How do I use the ereg()-function for this?
Well, I prefer the preg_functions
if (!preg_match("/^[0-9]{10}$/", $string)) {
// contains stuff other than numbers, or is less than 10 dig
Try
ereg("^[0-9]{10}$", $cust_tel);
Quick explanation (I get the feeling you're new at regexes):
^ - beginning of string
[0-9] - any number between 0 and 9 inclusive
{10} - exactly ten times
$ - end of string
There ya go.
J
B. Verbeek wrote:
> Hello,
>
> I want to check the data from a
I'm not sure if the ereg supports the inline greedy modifier like:
.+? or .*?
so:
ereg("<\?php.*?\?\>", $html, $phpIncludes);
if not use preg_match() instead...
"Christoph Starkmann" <[EMAIL PROTECTED]> wrote in message
B120D7EC8868D411A63D0050040EDA771118F3@XCHANGE">news:B120D7EC8868D411A63D
http://php.net/strtok
--
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 -
From: Dave Vanauken <[EMAIL
27 matches
Mail list logo