Word occurence in a list

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

Word occurence in a list

by Andy Jarrett :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Im trying to find a word occurence in a list (comma deliminated) using RegEx but the gray matter is letting me down.

Here's a sample list im using.

pass,pass,pass,10,andypass,pass,asdasdapass,pass,1pass,pass1,pass

and this is where i am at

[\,]+pass[\,]+

This gives me 100% positive results but doesnt use the first and last values D'oh

I've tried a few variations but so far no avail.

Any help would be appreciated.

Regards, Andy J

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:21:897
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/21
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:21
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.21
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Re: Word occurence in a list

by Peter Boughton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Can you not simply add a comma onto the start & end of the string list
before doing the RegEx?

On 25/07/05, Andy Jarrett <andy.jarrett@...> wrote:

> Hi,
>
> Im trying to find a word occurence in a list (comma deliminated) using RegEx but the gray matter is letting me down.
>
> Here's a sample list im using.
>
> pass,pass,pass,10,andypass,pass,asdasdapass,pass,1pass,pass1,pass
>
> and this is where i am at
>
> [\,]+pass[\,]+
>
> This gives me 100% positive results but doesnt use the first and last values D'oh
>
> I've tried a few variations but so far no avail.
>
> Any help would be appreciated.
>
> Regards, Andy J
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:21:898
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/21
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:21
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.21
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Re: Word occurence in a list

by Tony Hicks :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

,?pass,?

should work, it allows zero or one occurences of a comma before and after a word

,?\bpass\b,?

does the same thing as the above, but it looks for pass as a word by
itself so it wouldn't match things like andypass and pass1 and the
like.

Tony

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:21:899
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/21
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:21
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.21
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Re: Word occurence in a list

by Jerry Johnson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Either use the (^|,) (,|$) to optionally have the beginning of
string/end of string or comma or pad the front and back with a
hard-coded comma.(",#string#,")

On 7/25/05, Andy Jarrett <andy.jarrett@...> wrote:

> Hi,
>
> Im trying to find a word occurence in a list (comma deliminated) using RegEx but the gray matter is letting me down.
>
> Here's a sample list im using.
>
> pass,pass,pass,10,andypass,pass,asdasdapass,pass,1pass,pass1,pass
>
> and this is where i am at
>
> [\,]+pass[\,]+
>
> This gives me 100% positive results but doesnt use the first and last values D'oh
>
> I've tried a few variations but so far no avail.
>
> Any help would be appreciated.
>
> Regards, Andy J
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:21:900
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/21
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:21
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.21
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Re: Word occurence in a list

by Ben Doom :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Just a dumb question, but why use a regex at all?  I'm assuming that
there's a larger, surrounding issue.  That might help point to an
optimal solution.

--Ben

Andy Jarrett wrote:

> Hi,
>
> Im trying to find a word occurence in a list (comma deliminated) using RegEx but the gray matter is letting me down.
>
> Here's a sample list im using.
>
> pass,pass,pass,10,andypass,pass,asdasdapass,pass,1pass,pass1,pass
>
> and this is where i am at
>
> [\,]+pass[\,]+
>
> This gives me 100% positive results but doesnt use the first and last values D'oh
>
> I've tried a few variations but so far no avail.
>
> Any help would be appreciated.
>
> Regards, Andy J
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:21:901
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/21
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:21
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.21
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Re: Word occurence in a list

by Andy Jarrett :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Tony, cheers ,?\bpass\b,? work perfectly.

Ben, why use RegEx. Well cause i was doing it in CF. But it seemed a
waste of time going  looping through a list to find the occurences
when RegEx does it.

Cheers for your quick responses

Andy J


On 7/25/05, Ben Doom <bdoom-hof@...> wrote:

> Just a dumb question, but why use a regex at all?  I'm assuming that
> there's a larger, surrounding issue.  That might help point to an
> optimal solution.
>
> --Ben
>
> Andy Jarrett wrote:
> > Hi,
> >
> > Im trying to find a word occurence in a list (comma deliminated) using RegEx but the gray matter is letting me down.
> >
> > Here's a sample list im using.
> >
> > pass,pass,pass,10,andypass,pass,asdasdapass,pass,1pass,pass1,pass
> >
> > and this is where i am at
> >
> > [\,]+pass[\,]+
> >
> > This gives me 100% positive results but doesnt use the first and last values D'oh
> >
> > I've tried a few variations but so far no avail.
> >
> > Any help would be appreciated.
> >
> > Regards, Andy J
> >
> >
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:21:902
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/21
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:21
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.21
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Re: Word occurence in a list

by Tom Muck :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You can use ListValueCount(list, wordtofind)

Tom

Andy Jarrett wrote:

>Tony, cheers ,?\bpass\b,? work perfectly.
>
>Ben, why use RegEx. Well cause i was doing it in CF. But it seemed a
>waste of time going  looping through a list to find the occurences
>when RegEx does it.
>
>Cheers for your quick responses
>
>Andy J
>  
>
>  
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Purchase Studio MX with Flash Pro from House of Fusion, a Macromedia Authorized Affiliate and support the CF community.
http://www.houseoffusion.com/banners/view.cfm?bannerid=51

Message: http://www.houseoffusion.com/lists.cfm/link=i:21:903
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/21
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:21
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.21
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Re: Word occurence in a list

by Andy Jarrett :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Of course you can always use the built in CF way

D'oh D'oh D'oh D'oh D'oh D'oh D'oh D'oh D'oh D'oh D'oh D'oh D'oh

Time to read all the functions again.

D'oh D'oh D'oh D'oh

Cheers, Andy J

On 7/25/05, Tom Muck <tommuck@...> wrote:

> You can use ListValueCount(list, wordtofind)
>
> Tom
>
> Andy Jarrett wrote:
>
> >Tony, cheers ,?\bpass\b,? work perfectly.
> >
> >Ben, why use RegEx. Well cause i was doing it in CF. But it seemed a
> >waste of time going  looping through a list to find the occurences
> >when RegEx does it.
> >
> >Cheers for your quick responses
> >
> >Andy J
> >
> >
> >
> >
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:21:904
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/21
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:21
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.21
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54