House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  Regular Expressions (RegEx)

[URGENT] Incremental matches!

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Hello
is_maximum
11/19/08 08:21 A
Are you using ColdFusion?
Adrian Lynch
11/19/08 08:26 A
Adrian Lynch wrote:
is_maximum
11/19/08 12:11 P
Adrian Lynch wrote:
is_maximum
11/19/08 12:13 P
Well
is_maximum
11/20/08 12:33 P
well guys
is_maximum
11/22/08 02:12 P
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
is_maximum
11/19/2008 08:21 AM

Hello I have a string we call it position and this is in the form of '1.2.1.1' consider the current position I have is "1.1.2.1.3" I need to extract the following values: 1 1.1 1.1.2 1.1.2.1 1.1.2.1.3 or if position is "1.1.2" I need: 1 1.1 1.1.2 is this possible by using Regex? thanks ----- -- Regards Mohammad Norouzi Help each other to reach the future faster http://pixelshot.wordpress.com Pixelshot Photoblog http://brainable.blogspot.com Brainable Blog -- View this message in context: http://www.nabble.com/-URGENT--Incremental-matches%21-tp20577717p20577717.html Sent from the Cold Fusion - RegEx mailing list archive at Nabble.com.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Adrian Lynch
11/19/2008 08:26 AM

Are you using ColdFusion? No need to use RegEx, it's a list so: <cfoutput> <cfloop list="#position#" index="i">   #i#<br /> </cfloop> </cfoutput> Not a complete solution for you but you can see how to get at all the list elements. Adrian Building a database of ColdFusion errors at http://cferror.org/ Hello I have a string we call it position and this is in the form of '1.2.1.1' consider the current position I have is "1.1.2.1.3" I need to extract the following values: 1 1.1 1.1.2 1.1.2.1 1.1.2.1.3 or if position is "1.1.2" I need: 1 1.1 1.1.2 is this possible by using Regex? thanks ----- -- Regards Mohammad Norouzi

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
is_maximum
11/19/2008 12:11 PM

Adrian Lynch wrote: ----- Excess quoted text cut - see Original Post for more ----- Thanks Adrian, No actually I am using Java Regex but I think they are alike. I want not to use any for loop ----- -- Regards Mohammad Norouzi Help each other to reach the future faster http://pixelshot.wordpress.com Pixelshot Photoblog http://brainable.blogspot.com Brainable Blog -- View this message in context: http://www.nabble.com/-URGENT--Incremental-matches%21-tp20577717p20584340.html Sent from the Cold Fusion - RegEx mailing list archive at Nabble.com.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
is_maximum
11/19/2008 12:13 PM

Adrian Lynch wrote: ----- Excess quoted text cut - see Original Post for more ----- Thanks Adrian, No actually I am using Java Regex but I think they are alike. I want not to use any for loop ----- -- Regards Mohammad Norouzi Help each other to reach the future faster http://pixelshot.wordpress.com Pixelshot Photoblog http://brainable.blogspot.com Brainable Blog -- View this message in context: http://www.nabble.com/-URGENT--Incremental-matches%21-tp20577717p20584371.html Sent from the Cold Fusion - RegEx mailing list archive at Nabble.com.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Peter Boughton
11/19/2008 06:01 PM

> Thanks Adrian, No actually I am using Java Regex but I think they are alike. > I want not to use any for loop Why not? Can you provide more context as to what you're actually doing? It might enable a better answer. You can do: ^\d for 1 ^\d(\.\d){1} for 1.1 ^\d(\.\d){2} for 1.1.2 ^\d(\.\d){3} for 1.1.2.1 etc

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
is_maximum
11/20/2008 10:18 AM

Well, I have a tree structure in database in which each node has its own unique id as above, say 1.1.1.2.1 now by given a node and its position (the same id) I have to extract all its parents and return back to the client. the parents' ids are identified by that unique id (1, 1.1, 1.1.1 AND 1.1.1.2) if it was only one node there was no problem using a for loop but we may have hundreds of these nodes and should extract all of them each for a user concurrently and this is a performance issue now I am welcome if you can help me on this with anything better than Regex thanks Peter Boughton wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
is_maximum
11/20/2008 12:33 PM

Well Chris Porter, has just replied me with a smart solution but I can't test it right now until I get to work. I don't know why he can't post here. this is the solution: select * from NODE_TABLE where '1.1.1.2.1' like id + '%' and id not like '1.1.1.2.1%' We are using OpenJPA and Oracle database. I am eager to check if it works well Thanks all ----- -- Regards Mohammad Norouzi Help each other to reach the future faster http://pixelshot.wordpress.com Pixelshot Photoblog http://brainable.blogspot.com Brainable Blog -- View this message in context: http://www.nabble.com/-URGENT--Incremental-matches%21-tp20577717p20606201.html Sent from the Cold Fusion - RegEx mailing list archive at Nabble.com.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
is_maximum
11/22/2008 02:12 PM

well guys this works fine thank you all select * from NODE_TABLE where '1.1.1.2.1' like id + '%' and id not like '1.1.1.2.1%' ----- -- Regards Mohammad Norouzi Help each other to reach the future faster http://pixelshot.wordpress.com Pixelshot Photoblog http://brainable.blogspot.com Brainable Blog -- View this message in context: http://www.nabble.com/-URGENT--Incremental-matches%21-tp20577717p20639510.html Sent from the Cold Fusion - RegEx mailing list archive at Nabble.com.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
s. isaac dealey
11/19/2008 01:15 PM

----- Excess quoted text cut - see Original Post for more ----- I don't think there's a way to get that with a single regex... But this would work <cfset a = [] /> <cfloop index="x" list="1.1.2.1.3" delimiter="."> <cfset temp = a[arraylen(a)] /> <cfset temp = listappend(temp,x,".") /> <cfset arrayAppend(a,temp) /> </cfloop> -- s. isaac dealey  ^  new epoch isn't it time for a change?      ph: 781.769.0723 http://onTap.riaforge.org/blog


<< Previous Thread Today's Threads Next Thread >>

Search regex

May 23, 2013

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Designer, Developer and mobile workflow conference