Re: Regular Expression

2009-10-19 Thread adam

More elegant would be:

/^[a-z]+$/i

The i specifying that it is case-insensitive

irc.freenode.net #regex is a better place for your question, btw

On Oct 19, 2:26 pm, "Dave Maharaj :: WidePixels.com"
 wrote:
> Right on,
>
> I ended up using
>
> 'rule' => array('custom', '/^[A-Za-z ]+$/'), and that seems to work.
>
> Thanks,
>
> Dave
>
>   _  
>
> From: Maximillian Schwanekamp [mailto:anaxama...@gmail.com]
> Sent: October-19-09 4:32 PM
> To: cake-php@googlegroups.com
> Subject: Re: Regular Expression
>
> On Oct 19, 2009, at 10:41 AM, Dave Maharaj :: WidePixels.com wrote:
>
> I have 'rule' => '/^[a-zA-Z]$/', to allow only letter characters but it does
> not seem to be working.
> Is there something wrong with this expression?
>
> I think you need to specify how many characters you need.  E.g.
> /^[a-zA-Z]+$/ for at least one alpha char.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



RE: Regular Expression

2009-10-19 Thread Dave Maharaj :: WidePixels.com
Right on,
 
I ended up using 
 
'rule' => array('custom', '/^[A-Za-z ]+$/'), and that seems to work.
 
Thanks,
 
Dave

  _  

From: Maximillian Schwanekamp [mailto:anaxama...@gmail.com] 
Sent: October-19-09 4:32 PM
To: cake-php@googlegroups.com
Subject: Re: Regular Expression


On Oct 19, 2009, at 10:41 AM, Dave Maharaj :: WidePixels.com wrote:


I have 'rule' => '/^[a-zA-Z]$/', to allow only letter characters but it does
not seem to be working.
Is there something wrong with this expression?


I think you need to specify how many characters you need.  E.g.
/^[a-zA-Z]+$/ for at least one alpha char.





--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Regular Expression

2009-10-19 Thread Maximillian Schwanekamp
On Oct 19, 2009, at 10:41 AM, Dave Maharaj :: WidePixels.com wrote:

> I have 'rule' => '/^[a-zA-Z]$/', to allow only letter characters but  
> it does not seem to be working.
> Is there something wrong with this expression?

I think you need to specify how many characters you need.  E.g. /^[a- 
zA-Z]+$/ for at least one alpha char.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Regular expression in Router::connect

2007-05-15 Thread Matthias Bauer

On 15.05.2007 02:50 Aaron Shafovaloff wrote:

> I figured it out:
> 
> Router::connect('/:group/:curriculum/*',
> array('controller'=>'curriculum'),array('curriculum'=>'\b(?:(?!
> curriculum|courses|facilitators|configuration)\w)+\b'));

Your parens are off. The negative lookahead assertions should group all
the alternatives, so try:

\b(?!(?:curriculum|courses|facilitators|configuration))\w+\b


-Matt

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Regular expression in Router::connect

2007-05-14 Thread Aaron Shafovaloff

Hr turns out that doesn't really work. I give up.

On May 14, 6:50 pm, Aaron  Shafovaloff <[EMAIL PROTECTED]> wrote:
> Wooo hoo!
>
> I figured it out:
>
> Router::connect('/:group/:curriculum/*',
> array('controller'=>'curriculum'),array('curriculum'=>'\b(?:(?!
> curriculum|courses|facilitators|configuration)\w)+\b'));
>
> Thanks to:
>
> http://www.roscripts.com/PHP_regular_expressions_examples-136.html
>
> On May 14, 3:38 pm, Aaron  Shafovaloff <[EMAIL PROTECTED]> wrote:
>
> > With Router::connect I'd like to use a regular expression that would
> > say "the curriculum cannot be
> > xyz' ". Shouldn't this work?
>
> > Router::connect('/:group/:curriculum/*',
> > array('controller'=>'curriculum'),array('curriculum'=>'!xyz'));


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Regular expression in Router::connect

2007-05-14 Thread Aaron Shafovaloff

Wooo hoo!

I figured it out:

Router::connect('/:group/:curriculum/*',
array('controller'=>'curriculum'),array('curriculum'=>'\b(?:(?!
curriculum|courses|facilitators|configuration)\w)+\b'));

Thanks to:

http://www.roscripts.com/PHP_regular_expressions_examples-136.html

On May 14, 3:38 pm, Aaron  Shafovaloff <[EMAIL PROTECTED]> wrote:
> With Router::connect I'd like to use a regular expression that would
> say "the curriculum cannot be
> xyz' ". Shouldn't this work?
>
> Router::connect('/:group/:curriculum/*',
> array('controller'=>'curriculum'),array('curriculum'=>'!xyz'));


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Regular expression in Router::connect

2007-05-14 Thread Aaron Shafovaloff

By the way, I need it to exclude multiple strings. So something to the
effect of:

Router::connect('/:group/:curriculum/*',
array('controller'=>'curriculum'),array('curriculum'=>'!xyz AND !abc
AND !mno'));

On May 14, 3:38 pm, Aaron  Shafovaloff <[EMAIL PROTECTED]> wrote:
> With Router::connect I'd like to use a regular expression that would
> say "the curriculum cannot be
> xyz' ". Shouldn't this work?
>
> Router::connect('/:group/:curriculum/*',
> array('controller'=>'curriculum'),array('curriculum'=>'!xyz'));


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Regular Expression to find content inside a tag pair

2007-02-14 Thread Dat Chu
This is absolutely great. I will keep in mind these modifiers. Great answer
thank you.

On 2/14/07, Felix Geisendörfer <[EMAIL PROTECTED]> wrote:
>
>  Off the cuff I'd say: /(.*)/iUs.
>
> Most important are the modifiers:
>
>- i: Makes sure upper/lower- case are ignored (some people might use
>)
>- U: Makes sure that all quantifiers are ungreedy, meaning that
>they'll try to match the least amount of data only
>- s: Is the most important one, because it wil allow for the '.'
>character class to match line breaks which most forms will contain.
>
> Let me know if that works for you or not,
> -- Felix
> --
> http://www.thinkingphp.org
> http://www.fg-webdesign.de
>
>
> Dat Chu wrote:
>
> There are several things with anuke's pattern:
>
> First, it will not catch forms with attributes (=> my bad for not
> specifying this)
> Second, since * is greedy if I have 2 forms, it will capture the content
> between the wrong pairs of tags.
> Example of this: AAABBBCCC
>
> anuke's pattern will match the whole thing instead of just the first pair.
>
> On 2/13/07, anuke <[EMAIL PROTECTED]> wrote:
> >
> >
> > $pattern = '/(.*)<\/form>/';
> >
> > On 14 фев, 02:02, "Dat Chu" <[EMAIL PROTECTED]> wrote:
> > > I want to find the content inside of a tag pair.
> > >
> > > Say form tag. What would be the way to achieve this?
> > >
> > > My solution so far is using a regular expression similar to this
> > >
> > > /]*>(.*?)/
> >
> >
> >
> >
> >
> >
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Regular Expression to find content inside a tag pair

2007-02-14 Thread Felix Geisendörfer
> How does SimpleXML or DOMDocument->loadHTML performance in term of 
> simply finding certain form elements? Is there a requirement in 
> installation of PHP?
There is almost no chance for it to be faster then a specific regex, afaik.

-- Felix Geisendörfer aka the_undefined
--
http://www.thinkingphp.org
http://www.fg-webdesign.de


Dat Chu wrote:
> How does SimpleXML or DOMDocument->loadHTML performance in term of 
> simply finding certain form elements? Is there a requirement in 
> installation of PHP?
>
> On 2/14/07, * [EMAIL PROTECTED] * 
> <[EMAIL PROTECTED] > wrote:
>
>
> Why not use SimpleXML or DOMDocument->loadHTML() ? From there you'll
> have access to the complete DOM of the HTML.
>
> On Feb 14, 12:02 am, "Dat Chu" <[EMAIL PROTECTED]
> > wrote:
> > I want to find the content inside of a tag pair.
> >
> > Say form tag. What would be the way to achieve this?
> >
> > My solution so far is using a regular expression similar to this
> >
> > /]*>(.*?)/
>
>
>
> >

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Regular Expression to find content inside a tag pair

2007-02-14 Thread Dat Chu
How does SimpleXML or DOMDocument->loadHTML performance in term of simply
finding certain form elements? Is there a requirement in installation of
PHP?

On 2/14/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
> Why not use SimpleXML or DOMDocument->loadHTML() ? From there you'll
> have access to the complete DOM of the HTML.
>
> On Feb 14, 12:02 am, "Dat Chu" <[EMAIL PROTECTED]> wrote:
> > I want to find the content inside of a tag pair.
> >
> > Say form tag. What would be the way to achieve this?
> >
> > My solution so far is using a regular expression similar to this
> >
> > /]*>(.*?)/
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Regular Expression to find content inside a tag pair

2007-02-14 Thread [EMAIL PROTECTED]

Why not use SimpleXML or DOMDocument->loadHTML() ? From there you'll
have access to the complete DOM of the HTML.

On Feb 14, 12:02 am, "Dat Chu" <[EMAIL PROTECTED]> wrote:
> I want to find the content inside of a tag pair.
>
> Say form tag. What would be the way to achieve this?
>
> My solution so far is using a regular expression similar to this
>
> /]*>(.*?)/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Regular Expression to find content inside a tag pair

2007-02-13 Thread Felix Geisendörfer
Off the cuff I'd say: /(.*)/iUs.

Most important are the modifiers:

* i: Makes sure upper/lower- case are ignored (some people might use
  )
* U: Makes sure that all quantifiers are ungreedy, meaning that
  they'll try to match the least amount of data only
* s: Is the most important one, because it wil allow for the '.'
  character class to match line breaks which most forms will contain.

Let me know if that works for you or not,
-- Felix
--
http://www.thinkingphp.org
http://www.fg-webdesign.de


Dat Chu wrote:
> There are several things with anuke's pattern:
>
> First, it will not catch forms with attributes (=> my bad for not 
> specifying this)
> Second, since * is greedy if I have 2 forms, it will capture the 
> content between the wrong pairs of tags.
> Example of this: AAABBBCCC
>
> anuke's pattern will match the whole thing instead of just the first pair.
>
> On 2/13/07, * anuke* <[EMAIL PROTECTED] > 
> wrote:
>
>
> $pattern = '/(.*)<\/form>/';
>
> On 14 фев, 02:02, "Dat Chu" <[EMAIL PROTECTED]
> > wrote:
> > I want to find the content inside of a tag pair.
> >
> > Say form tag. What would be the way to achieve this?
> >
> > My solution so far is using a regular expression similar to this
> >
> > /]*>(.*?)/
>
>
>
>
> >

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Regular Expression to find content inside a tag pair

2007-02-13 Thread Dat Chu
There are several things with anuke's pattern:

First, it will not catch forms with attributes (=> my bad for not specifying
this)
Second, since * is greedy if I have 2 forms, it will capture the content
between the wrong pairs of tags.
Example of this: AAABBBCCC

anuke's pattern will match the whole thing instead of just the first pair.

On 2/13/07, anuke <[EMAIL PROTECTED]> wrote:
>
>
> $pattern = '/(.*)<\/form>/';
>
> On 14 фев, 02:02, "Dat Chu" <[EMAIL PROTECTED]> wrote:
> > I want to find the content inside of a tag pair.
> >
> > Say form tag. What would be the way to achieve this?
> >
> > My solution so far is using a regular expression similar to this
> >
> > /]*>(.*?)/
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Regular Expression to find content inside a tag pair

2007-02-13 Thread anuke

$pattern = '/(.*)<\/form>/';

On 14 фев, 02:02, "Dat Chu" <[EMAIL PROTECTED]> wrote:
> I want to find the content inside of a tag pair.
>
> Say form tag. What would be the way to achieve this?
>
> My solution so far is using a regular expression similar to this
>
> /]*>(.*?)/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---