findall

Python regex findall numbers and dots

Hi, I'm using re.findall() to extract some version numbers from an HTML file: >>> import re >>> text = "<table><td><a href=\"url\">Test0.2.1.zip</a></td><td>Test0.2.1</td></table> Test0.2.1" >>> re.findall("Test([\.0-9]*)", text) ['0.2.1.', '0.2.1', '0.2.1'] but I would like to only get the ones that do not end in a dot. The filename ...

$data findAll query in CakePHP checking values from second table

Hello there, I have been stumped by CakePHP in how to query the DB in CakePHP and return things to $data only when the $data query table [id] has a matching [sub_id] in a second table a standard query: $data = $this->Table1->findAll(array("Table1.deleted" => "0"), null, "Table1.id DESC", 25, null, 1); But I want to only have values p...

Method chaining generic list extensions

I have a List of a "complex" type - an object with a few string properties. The List itself is a property of another object and contains objects of a variety of types, as shown in this abbreviated class structure: Customer { public List<Characteristic> Characteristics; . . . } Characteristic { public string Characterist...

How do I perform a FindAll() on an IList<T>? (eg. SortedList.Values)

I'm working on a problem in C# 2.0/.NET 2.0 where I have a Sortedlist and want to search all the "values" (not the "keys") of this SortedList for a certain substring and count up how many occurrences there are. This is what I'm trying to do: { Sortedlist<string,string> mySortedList; // some code that instantiates mySortedList and...

Java: What is the best way to find elements in a sorted List?

I have a List<Cat> sorted by the cats' birthdays. Is there an efficient Java Collections way of finding all the cats that were born on January 24th, 1983? Or, what is a good approach in general? ...

Adding a parameter to a FindAll for a Generic List in C#

I have a list of objects that I want to filter by an integer parameter List<testObject> objectList = new List<testObject>(); // populate objectList with testObjects objectList.FindAll(GroupLevel0); private static bool GroupLevel0(testObject item) { return item._groupLevel == 0; } private class testObject { public string _FieldS...

findAll() Not Returning Correct Object Type

ItemTag objects contain an Item object and a Tag object. (These are Java domain objects.) This simple query works as expected. I get back a list ItemTags and can do all the wonderful things that ItemTags are supposed to do: def theTags1 = ItemTag.findAll("from ItemTag b") For example: println(theTags1[0].tag.tag) gives me this as...

Groovy findAll closure parameters

Hi All! I'm want use groovy findAll with my param to filtering closure filterClosure = { it, param -> it.getParam == param } How now i'm can call this closure in findAll? Something lik bellow? myColl = someColl.findAll(filterClosure ??? ) ...

What is the equivalent of Python's "findAll" function in PHP?

re.findall(r'(\b[a-zA-Z][a-zA-Z0-9-]*)(?=\.com\b)', DATA) how would this line be in PHP? ...

Grails: How to combine findAllBy and findAllByTag

Hi, as I am new to Grails and dynamic languages, I do have some 'hopefully simple' question. I installed the taggable plugin which works fine. There is an array coming in with tags. I collect for every tag the set of data with findAllByTag. After that I randomise it and pick one entry. Works great. Now I decided not to take all objects...

Python regexp find two keywords in a line

I'm having a hard time understanding this regex stuff... I have a string like this: <wn20schema:NounSynset rdf:about="&dn;synset-56242" rdfs:label="{saddelmageri_1}"> I want to use findall() and groups to get this: ['56242','saddelmageri'] I can match the number with something like "synset-[0-9]" and the word with something like "...

Groovy findAll and each tag question

Hi I have the following domain classes: class User = { String username ... Company company } class Company { String name ... } That is, there is a n:1 relationship between user and company. These classes are so and I cannot change them. At the show.gsp I want to have the details of the company togethe...

Having troubles with a simple Prolog question

I was resolving some prolog exercises when I fond myself with some difficulties resolving the following one: Consider you have this fact base about object: object(obj1). object(obj2). object(obj3). object(obj4). object(obj5). material(obj1,wood). material(obj2,wood). material(obj3, glass). material(obj4, glass). material(obj5, ...

C# Generic List - FindAll on child Arrays

I'm trying to find the best approach to filtering a list with C# (3.5) but I can't seem to find any examples that are similar to my situation. I'm open to using lambdas or linq. The thing that is unique compared to most of the examples that I've found, is that my list items each have child arrays for example... var employees= new Lis...

C# FindAll VS Where Speed

Anyone know any speed differences between Where and FindAll on List. I know Where is part of IEnumerable and FindAll is part of List, I'm just curious what's faster. ...

Rails ActiveRecord: Is a combined :include and :conditions query possible?

Imagine I have wiki Articles, with many Revisions. I'd like to do a query with ActiveRecord through the database, which only returns those Articles which have Revisions which are updated in the past 24 hours. Is such a thing possible? I'd imagine it'd be something like: Articles.find_all(:include => :revisions, :co...

How do I ensure I always get a list of matches from Python's Regular Expressions?

I'm trying to pull some information (no recursion necessary) from a jsp page (malformed xml) similar to this: <td> <html:button ...></html:button> <html:submit ...></html:submit></td> And a regex: <html:(button|submit|cancel)[\s\S]*?</html:(button|submit|cancel)> re.findall() is giving me a list of tuples, like so: [('button','but...

Predicates and Lists

Hello guys, I have a generic list. Some elements of this list belong to a parent element. I retrieved all these elements from a database and i want to recursively build a tree with them. So, here's what i'm thinking: Here is my predicate: public static bool FindChildren(Int32 parentId,CategoryMapping catMapping) { if (catMapping...

Using FindAll on a List<List<T>> type

Assuming public class MyClass { public int ID {get; set; } public string Name {get; set; } } and List<MyClass> classList = //populate with MyClass instances of various IDs I can do List<MyClass> result = classList.FindAll(class => class.ID == 123); and that will give me a list of just classes with ID = 123. Works great, l...

grails findAll tag

How to use "SELECT id, name, part, description FROM user " in grails findAll tag. I tried User.findAll("SELECT id, name, part, description FROM user") instead using User.findAll("FROM user") But shows errors . can anyone suggest me the tag thanks, sri.. ...