Sort cut for 0 or 1.

View: New views
8 Messages — Rating Filter:   Alert me  

Sort cut for 0 or 1.

by Ian Skinner-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Is there a regex shortcut for exactly  zero OR one instance?  I.E. {0,1}?

TIA
Ian

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: http://www.houseoffusion.com/groups/RegEx/message.cfm/messageid:1113
Subscription: http://www.houseoffusion.com/groups/RegEx/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user837.14401.21



RE: Sort cut for 0 or 1.

by Adrian Lynch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yup, +

Adrian
http://www.adrianlynch.co.uk/

-----Original Message-----
From: Ian Skinner
Sent: 23 January 2008 16:16
To: RegEx
Subject: Sort cut for 0 or 1.


Is there a regex shortcut for exactly  zero OR one instance?  I.E. {0,1}?

TIA
Ian

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: http://www.houseoffusion.com/groups/RegEx/message.cfm/messageid:1114
Subscription: http://www.houseoffusion.com/groups/RegEx/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user837.14401.21



Re: Sort cut for 0 or 1.

by Ian Skinner-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Adrian Lynch wrote:
> Yup, +
>
> Adrian
> http://www.adrianlynch.co.uk/
It is my understanding that + is 'one *or more* times.'  I don't want
the 'or more' part.  In this particular case it needs to be zero times
or one time, nothing more (or less if that is possible).  {0,1} works
well.  But I thought that this is such a common thing, at least I have
been writing it a lot, that there could be a short cut for it.





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: http://www.houseoffusion.com/groups/RegEx/message.cfm/messageid:1115
Subscription: http://www.houseoffusion.com/groups/RegEx/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user837.14401.21



RE: Sort cut for 0 or 1.

by Adrian Lynch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sorry, my bad. I was too quick off with the answer. It's ? to match zero or
one.

Adrian

-----Original Message-----
From: Ian Skinner
Sent: 23 January 2008 16:31
To: RegEx
Subject: Re: Sort cut for 0 or 1.


Adrian Lynch wrote:
> Yup, +
>
> Adrian
> http://www.adrianlynch.co.uk/
It is my understanding that + is 'one *or more* times.'  I don't want
the 'or more' part.  In this particular case it needs to be zero times
or one time, nothing more (or less if that is possible).  {0,1} works
well.  But I thought that this is such a common thing, at least I have
been writing it a lot, that there could be a short cut for it.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: http://www.houseoffusion.com/groups/RegEx/message.cfm/messageid:1116
Subscription: http://www.houseoffusion.com/groups/RegEx/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user837.14401.21




Re: Sort cut for 0 or 1.

by Steve Bryant-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I think you are looking for:

?

At 10:30 AM 1/23/2008, Ian Skinner wrote:

>Adrian Lynch wrote:
> > Yup, +
> >
> > Adrian
> > http://www.adrianlynch.co.uk/
>It is my understanding that + is 'one *or more* times.'  I don't want
>the 'or more' part.  In this particular case it needs to be zero times
>or one time, nothing more (or less if that is possible).  {0,1} works
>well.  But I thought that this is such a common thing, at least I have
>been writing it a lot, that there could be a short cut for it.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: http://www.houseoffusion.com/groups/RegEx/message.cfm/messageid:1117
Subscription: http://www.houseoffusion.com/groups/RegEx/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user837.14401.21



Re: Sort cut for 0 or 1.

by Ian Skinner-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Adrian Lynch wrote:
> Sorry, my bad. I was too quick off with the answer. It's ? to match zero or
> one.
>
> Adrian
*DOH!*

Of course it is ?.  My brain just did no go there, for some reason I
just did not make the equation of 'optional' as the same as '{0,1}'.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: http://www.houseoffusion.com/groups/RegEx/message.cfm/messageid:1118
Subscription: http://www.houseoffusion.com/groups/RegEx/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user837.14401.21



Re: Sort cut for 0 or 1.

by schnee :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 >>Yup, +

Hem, no, + is for 1 or more.
zero or one is simply ?

--
_______________________________________
REUSE CODE! Use custom tags;
See http://www.contentbox.com/claude/customtags/tagstore.cfm
(Please send any spam to this address: piegeacon@...)
Thanks.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: http://www.houseoffusion.com/groups/RegEx/message.cfm/messageid:1119
Subscription: http://www.houseoffusion.com/groups/RegEx/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user837.14401.21



Re: Sort cut for 0 or 1.

by Peter Boughton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Possibly being pedantic, but ? is more "1 or 0" - it will match if it's
there, but not fussed if it isn't.
"0 or 1" would be the lazy optional ?? which will only match if it has to,
but wont if it can avoid it.


On Jan 23, 2008 4:54 PM, Ian Skinner <HOF@...> wrote:

> Adrian Lynch wrote:
> > Sorry, my bad. I was too quick off with the answer. It's ? to match zero
> or
> > one.
> >
> > Adrian
> *DOH!*
>
> Of course it is ?.  My brain just did no go there, for some reason I
> just did not make the equation of 'optional' as the same as '{0,1}'.
>
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: http://www.houseoffusion.com/groups/RegEx/message.cfm/messageid:1120
Subscription: http://www.houseoffusion.com/groups/RegEx/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user837.14401.21