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.

853 questions
178
votes
13 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 namespaces. I truncate part of xml file as sample:
KevinLeng
  • 1,843
  • 2
  • 12
  • 7
44
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
  • 483
  • 1
  • 6
  • 13
43
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,294
  • 12
  • 51
  • 73
30
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
  • 32,215
  • 30
  • 128
  • 239
16
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
  • 8,338
  • 10
  • 52
  • 95
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
  • 17,625
  • 17
  • 69
  • 81
14
votes
3 answers

Capturing named groups in regex with re.findall

When I was trying to answer this question: regex to split %ages and values in python I noticed that I had to re-order the groups from the result of findall. For example: data = """34% passed 23% failed 46% deferred""" result = {key:value for value,…
ashwinjv
  • 2,787
  • 1
  • 23
  • 32
13
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,768
  • 19
  • 69
  • 117
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
  • 2,014
  • 5
  • 21
  • 25
11
votes
3 answers

Regex findall start() and end() ? Python

i'm trying to get the start and end positions of a query in sequence by using re.findall import re sequence = 'aaabbbaaacccdddeeefff' query = 'aaa' findall = re.findall(query,sequence) >>> ['aaa','aaa'] how do i get something like…
O.rka
  • 29,847
  • 68
  • 194
  • 309
10
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
  • 225
  • 4
  • 10
10
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
  • 143
  • 1
  • 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
  • 8,088
  • 8
  • 25
  • 40
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
  • 1,047
  • 11
  • 25
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
  • 535
  • 1
  • 7
  • 15
1
2 3
56 57