Re: [PHP] Pattern Matching

2009-08-07 Thread Floyd Resler

Martin,
	Thanks!  Not only did that help tremendously but it also gave me a  
better understand of regular expressions.


Thanks!
Floyd

On Aug 6, 2009, at 6:15 PM, Martin Scotta wrote:


here you have the regexp's

 = \d{8}
AA = \w{6}
#A? = [\w\d]* (change the * for + to require at least 1 character)
##-A#A = \d\d-\w\d\w

On Thu, Aug 6, 2009 at 6:57 PM, Floyd Resler   
wrote:
I need some assistance in pattern matching.  I want allow the admin  
user to enter a pattern to be matched in my order form editor.  When  
someone then places an order I want to do a match based on that  
pattern.  Some of the examples I thought for the patterns are:

 - must be numeric and 8 digits
AA - must be alpha and 6 characters
#A? - must be alphanumeric any length
##-A#A - must have two numbers, a dash, a letter, a number, and a  
letter


I'm sure regular expressions are the answers but I am not well- 
versed in those at all and I'm not sure how to make the above  
patterns work in or even they are the best examples to use.  Any  
help would be greatly appreciated.


Thanks!
Floyd


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
Martin Scotta




Re: [PHP] Pattern Matching

2009-08-06 Thread Martin Scotta
here you have the regexp's

 = \d{8}
AA = \w{6}
#A? = [\w\d]* (change the * for + to require at least 1 character)
##-A#A = \d\d-\w\d\w

 wrote:

> I need some assistance in pattern matching.  I want allow the admin user to
> enter a pattern to be matched in my order form editor.  When someone then
> places an order I want to do a match based on that pattern.  Some of the
> examples I thought for the patterns are:
>  - must be numeric and 8 digits
> AA - must be alpha and 6 characters
> #A? - must be alphanumeric any length
> ##-A#A - must have two numbers, a dash, a letter, a number, and a letter
>
> I'm sure regular expressions are the answers but I am not well-versed in
> those at all and I'm not sure how to make the above patterns work in or even
> they are the best examples to use.  Any help would be greatly appreciated.
>
> Thanks!
> Floyd
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Martin Scotta


[PHP] Pattern Matching

2009-08-06 Thread Floyd Resler
I need some assistance in pattern matching.  I want allow the admin  
user to enter a pattern to be matched in my order form editor.  When  
someone then places an order I want to do a match based on that  
pattern.  Some of the examples I thought for the patterns are:

 - must be numeric and 8 digits
AA - must be alpha and 6 characters
#A? - must be alphanumeric any length
##-A#A - must have two numbers, a dash, a letter, a number, and a letter

I'm sure regular expressions are the answers but I am not well-versed  
in those at all and I'm not sure how to make the above patterns work  
in or even they are the best examples to use.  Any help would be  
greatly appreciated.


Thanks!
Floyd


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Pattern Matching[Resolved]

2009-07-15 Thread VamVan
On Wed, Jul 15, 2009 at 4:21 AM, Lenin  wrote:

> On Wed, Jul 15, 2009 at 3:24 AM, VamVan wrote:
>
> > contact/me - Contact US
> >
> > perfect match would be easy because I can exactly look for what I want.
> >
> > It becomes tricky when I introduce wild cards like contact/* for example.
> It
> > could also be contact/me/*
> >
> > How would I match patterns for this kind of relative matches.? Any ideas
> > anyone?
>
>
> Use preg_match function to do that.


Ok here is how I solved it. When I have a url like www.xx.ccom/a/b/c for
example, what I do is
get an array of abc, ab, a

Then I run a union query for all three combinations. So basically select *
from {lookup_table} WHERE path = 'abc' UNION select 

Then I just retrieve the first row  mysql_fetch_object. That is what I need.

Thanks Anyways
V


Re: [PHP] Pattern Matching

2009-07-15 Thread Lenin
On Wed, Jul 15, 2009 at 3:24 AM, VamVan wrote:

> contact/me - Contact US
>
> perfect match would be easy because I can exactly look for what I want.
>
> It becomes tricky when I introduce wild cards like contact/* for example. It
> could also be contact/me/*
>
> How would I match patterns for this kind of relative matches.? Any ideas
> anyone?


Use preg_match function to do that.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Pattern Matching

2009-07-14 Thread VamVan
Hello Guys,

I have a question related to pattern matching and wildcards. This is the
scenario.

I have friendly urls on my website. So retrive their path as arguments for
every page.

so for example if I have www.xx.com/contact/me my args array will be

args(
   0 => contact,
   1 => me
)

My requirement is to change the page title on the fly with specific
patterns, so what I do is define a look up table with these columns.

path, pageTitle

contact/me - Contact US

perfect match would be easy because I can exactly look for what I want.

It becomes tricky when I introduce wild cards like contact/* for example. It
could also be contact/me/*

How would I match patterns for this kind of relative matches.? Any ideas
anyone?

Thanks,
V


Re: [PHP] pattern matching for the dot-sign

2003-06-05 Thread CPT John W. Holmes
> I am looking for a way to replace "." (=dot) to "," in a string with
either
> ereg_replace or preg_match . I read the manual in PHP on Pattern matching
> for preg_match but could not immediately trace it.
> All help appreciated.

If that's all you need to do, use str_replace().

---John Holmes...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] pattern matching for the dot-sign

2003-06-05 Thread Wim Paulussen
LS,

I am looking for a way to replace "." (=dot) to "," in a string with either
ereg_replace or preg_match . I read the manual in PHP on Pattern matching
for preg_match but could not immediately trace it.
All help appreciated.

Wim


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] pattern matching urls

2002-08-26 Thread Justin French

I spotted a class or function on phpclasses.org a few days back that does
this.

Justin French


on 28/08/02 4:40 AM, tux ([EMAIL PROTECTED]) wrote:

> 
> 
> 
> hey all,
> 
> Just wanting some advice on something im doing, basically im storing
> news into mysql and what i want to do is, when the news is displayed, if
> a url is in there ie(http://www.blahblah.com OR
> mailto:[EMAIL PROTECTED]) it will automatically be displayed as a link,
> im considering using preg_match for this but i was wondering if there is
> any other function already designed for automatically detecting urls?
> 
> cheers,
> 
> Jo
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] pattern matching urls

2002-08-26 Thread tux




hey all,

Just wanting some advice on something im doing, basically im storing
news into mysql and what i want to do is, when the news is displayed, if
a url is in there ie(http://www.blahblah.com OR
mailto:[EMAIL PROTECTED]) it will automatically be displayed as a link,
im considering using preg_match for this but i was wondering if there is
any other function already designed for automatically detecting urls? 

cheers,

Jo


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Pattern matching in PHP

2002-03-13 Thread RIVES Sergio

i guess you are searching for this function :
number_format($number);
http://www.php.net/manual/en/function.number-format.php

Hope it could help you

SR

Claudiu a écrit :

Claudiu a écrit :

> Hello!
>
> I have a number... say 12234109 i want to transform it to 12,234,109
> or 10312 transformed to 10,312 ... i guess you got my point..
>
> Is there a way doing this... I believe pattern matching...but i dont know
> how to do it...
> Or any other solution?
> Thanks...
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Pattern matching in PHP

2002-03-13 Thread Claudiu

Hello!

I have a number... say 12234109 i want to transform it to 12,234,109
or 10312 transformed to 10,312 ... i guess you got my point..


Is there a way doing this... I believe pattern matching...but i dont know
how to do it...
Or any other solution?
Thanks...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Pattern matching and replacement!

2001-05-08 Thread heinisch

At 08.05.01  10:03, you wrote:
>
>Hello all,
>
>I have a slight problem.  I am storing an email template in a MySQL DB.
>Portions of the email have text that need to be replaced with variable
>values when run through the script
>ex:
>
>Sehr geehrte(r) Frau/Herr {%Last_Name%} ,
>Dies ist eine automatische Zusendung von ACNS Billing and Support Software.
>
>Ihre Zahlung von  DM {%Prev_Total%} fuer ihr ACNS Domain und/oder ihr
>Internet Flatrate

As you can see. I am using the {% and %} to delimit the parts that need to
>be replaced.  I can't get the replacements to work right though.  Can
>someone help?
why don´t you store something like:
Sehr geehrte(r) Frau/Herr $Last_Name ,
an then use the eval() function, to fill your vars? Otherwise you have to 
str_replace() this {%Last_Name%},
think that would be more work.
HTH Oliver


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Pattern matching and replacement!

2001-05-08 Thread Jason Murray

> As you can see. I am using the {% and %} to delimit the parts 
> that need to be replaced.  I can't get the replacements to work 
> right though.  Can someone help?

$text = ereg_replace("\{\%Last_Name\%\}", $lastname, $text);

Should be something like that :)

Jason

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Pattern matching and replacement!

2001-05-08 Thread Charles Williams \(CEO\)

Hello all,

I have a slight problem.  I am storing an email template in a MySQL DB.
Portions of the email have text that need to be replaced with variable
values when run through the script.

ex:

Sehr geehrte(r) Frau/Herr {%Last_Name%} ,

Dies ist eine automatische Zusendung von ACNS Billing and Support Software.

Ihre Zahlung von  DM {%Prev_Total%} fuer ihr ACNS Domain und/oder ihr
Internet Flatrate
konto wurde von ihrer Bank uneingeloest zurueckgegeben.  Daher moechten wir
Sie bitten innerhalb der naechsten 4 werktage, dies zu begleichen.  Werktage
zaehlen ab dem  {%Today_Date%}.

Konto/Kunden #: {%Customer_ID%}
Vorheriger Betrag: DM {%Prev_Total%}
Mahngebuehr: DM 19,99



As you can see. I am using the {% and %} to delimit the parts that need to
be replaced.  I can't get the replacements to work right though.  Can
someone help?

Thanks in advance.

chuck


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]