Questions tagged [findall]

Finds all matching sub-elements, by tag name or path. Many questions use this tag to refer to the python regular expression findall. https://docs.python.org/3/library/re.html Use the tag prolog-findall if the question relates to the Prolog findall/3 predicate.

FindAll is a method or operation that returns all of the items that meet the specified criteria.

712 questions
148
votes
11 answers

Python ElementTree module: How to ignore the namespace of XML files to locate matching element when using the method "find", "findall"

I want to use the method of "findall" to locate some elements of the source xml file in the ElementTree module. However, the source xml file (test.xml) has namespace. I truncate part of xml file as sample:
KevinLeng
  • 1,543
  • 2
  • 10
  • 7
42
votes
1 answer

Groovy filter criteria on findAll on a list

I trying to build dynamic filters using findAll on a list. I have a variable that needs to be included in the filter only if not null. @Test void testSample(){ def list = [ new Employee(age:22, isManager:false), …
Kiran Chitturi
  • 453
  • 1
  • 6
  • 12
41
votes
5 answers

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.
Dested
  • 6,014
  • 11
  • 50
  • 71
25
votes
2 answers

Finding all references to a method with Roslyn

I'm looking to scan a group of .cs files to see which ones call the Value property of a Nullable (finding all references). For example, this would match: class Program { static void Main() { int? nullable = 123; int value…
James Ko
  • 25,479
  • 23
  • 92
  • 196
15
votes
2 answers

python - regex search and findall

I need to find all matches in a string for a given regex. I've been using findall() to do that until I came across a case where it wasn't doing what I expected. For example: regex = re.compile('(\d+,?)+') s = 'There are 9,000,000 bicycles in…
armandino
  • 14,813
  • 16
  • 65
  • 76
12
votes
1 answer

What is the VB.NET syntax for using List.FindAll() with a lambda?

In C# I have been performing a FindAll in a generic list as follows: List tlist = list.FindAll(p => p.parid == titem.catid); Two questions, is this the appropriate way of performing such a thing and how do I convert this to VB.Net
mattgcon
  • 4,388
  • 17
  • 60
  • 112
11
votes
1 answer

Python regex findall numbers and dots

I'm using re.findall() to extract some version numbers from an HTML file: >>> import re >>> text = "
Test0.2.1.zipTest0.2.1
Test0.2.1" >>> re.findall("Test([\.0-9]*)", text) ['0.2.1.', '0.2.1',…
Ashy
  • 1,893
  • 5
  • 20
  • 24
10
votes
6 answers

Why does re.findall return a list of tuples when my pattern only contains one group?

Say I have a string s containing letters and two delimiters 1 and 2. I want to split the string in the following way: if a substring t falls between 1 and 2, return t otherwise, return each character So if s = 'ab1cd2efg1hij2k', the expected…
usual me
  • 7,130
  • 6
  • 40
  • 81
9
votes
1 answer

Extract salaries from a list of strings

I'm trying to extract salaries from a list of strings. I'm using the regex findall() function but it's returning many empty strings as well as the salaries and this is causing me problems later in my code. sal= '41 000€ à 63 000€ / an' #this is a…
Ceal Clem
  • 175
  • 2
  • 8
9
votes
2 answers

BeautifulSoup with multiple tags, each tag with a specific class

I am trying to use beautifulsoup to parse a table from a website. (I am unable to share the website source code as it is restricted use.) I am trying to extract the data only if it has following two tags with these specific classes. td,…
PagMax
  • 6,209
  • 7
  • 21
  • 36
9
votes
1 answer

How to get the hidden input's value by using python?

How can i get input value from html page like I have input name [ name="captId" ] and need his value import re , urllib , urllib2 a =…
IBRA
  • 133
  • 1
  • 2
  • 7
9
votes
1 answer

How to use symbolic group name using re.findall()

Is it possible to access the symbolic group name defined in a regular expression with (?P...) with the equivalent of re.findall()? Using re.match(), re returns a MatchObject on which the function .group('toto') can be used... I would like to…
Thomas Leonard
  • 957
  • 8
  • 24
9
votes
4 answers

extbase repository findAll() returns result null

I have several Controllers like those: CategoryController and NewsController As well as the domain models for category and news and reposirtories for both. In the NewsController I do a dependencyInjection like this (the same way as in…
kapale
  • 485
  • 1
  • 7
  • 14
8
votes
1 answer

Grails: Is there a way to have findAll() without a query but with pagination and sorting?

As I noticed in the answers of another question there are a few problems when testing finder methods in GORM. I want to get all objects from Something and have support for sorting and pagination, so I wrote this: SomethingListVO…
hering
  • 1,916
  • 4
  • 28
  • 43
8
votes
4 answers

How do I ensure that re.findall() stops at the right place?

Here is the code I have: a='aaaaaa2aaa3' import re re.findall(r'<(title)>(.*)<(/title)>', a) The result is: [('title', 'aaaaaa2aaa3', '/title')] If I ever designed a…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/python" class="post-tag grid--cell" title="show questions tagged 'python'" rel="tag">python</a> <a href="../../questions/tagged/regex" class="post-tag grid--cell" title="show questions tagged 'regex'" rel="tag">regex</a> <a href="../../questions/tagged/python-2.7" class="post-tag grid--cell" title="show questions tagged 'python-2.7'" rel="tag">python-2.7</a> <a href="../../questions/tagged/findall" class="post-tag grid--cell" title="show questions tagged 'findall'" rel="tag">findall</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card__deleted"> <time class="s-user-card--time" datetime="asked Jul 20 '13 at 19:15">asked Jul 20 '13 at 19:15</time> <div class="s-avatar s-avatar__32 s-user-card--avatar"> </div> <div class="s-user-card--info">user2602606</div> </div> </div> </div> </div> </div> </div> <div class="s-pagination pager fr"> <div class="s-pagination--item is-selected">1</div> <a class="s-pagination--item" href="../../questions/tagged/findall_page=2" rel="" title="Go to page 2">2</a> <a class="s-pagination--item" href="../../questions/tagged/findall_page=3" rel="" title="Go to page 3">3</a> <div class="s-pagination--item s-pagination--item__clear">…</div> <a class="s-pagination--item" href="../../questions/tagged/findall_page=47" rel="" title="Go to page 47">47</a> <a class="s-pagination--item" href="../../questions/tagged/findall_page=48" rel="" title="Go to page 48">48</a> <a class="s-pagination--item" href="../../questions/tagged/findall_page=2" rel="next" title="Go to page 2"> Next</a> </div> </div> </div> </div> </div> <script src="../../static/js/stack-icons.js"></script> <script> /* replace <time class="fromnow" /> with human delta between `datetime` attr and now */ document.addEventListener('DOMContentLoaded', function(){ var time_elements = document.querySelectorAll("time.fromnow"); for (var i=0; i<time_elements.length; i++) { time_elements[i].innerHTML = moment(time_elements[i].getAttribute("datetime")).fromNow(); } }); </script> </body> </html>