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
-2
votes
4 answers

sre.findall() in parsing web page

I'm using urllib2 and sre in Python to parse data from aprs.fi so I can use weather data in some real time high altitude balloon code I'm working on. The parsing code is pretty simple: import urllib2 import sre APRStracking = urllib2.urlopen(…
-3
votes
1 answer

python find all strings starting and ending with certain characters

How can I extract with python all strings starting with 'a[' and ending with ']'? for example str= "a[0]*x**3+a[13]" result : a[0], a[13] thanks
-3
votes
3 answers

insert a new line to a file if findall finds a search pattern

I would like to add a new line to a file after findall finds a search pattern. The code I use only writes the content of the input file to the output file. It doesn't add new line to the output file. How can I fix my code? import re text = """ Hi!…
erhan
  • 317
  • 1
  • 6
  • 16
-3
votes
3 answers

re find date in string

Can someone explain how to use re.find all to separate only dates from the following strings? When the date can be either of the format- 1.1.2001 or 11.11.2001. There is volatile number of digits in the string representing days and months- import…
Slav3k
  • 37
  • 9
-3
votes
1 answer

findall() behaviour (python 2.7)

Suppose I have the following string: "

Hello

NOT

World

" and i want to extract the words Hello and World I created the following script for the job #!/usr/bin/env python import re string = "

Hello

NOT

World

" match =…
persongr
  • 11
  • 5
-3
votes
1 answer

Find certain data with regular expression

I have a file in the following format: someinformation="someNumbers"-result My code is: re.findall('someinformation="(.*?)"-result', str(data)) Given the example: test1="3"-result I want to get 3, but my code doesn't find…
mat
  • 77
  • 1
  • 1
  • 6
-4
votes
1 answer

need to create Python regex for 65$ or $65 values

I trying to use: price = str(re.findall(r"\$[^ ]+", msg_content)) and price value is: XX.XX$ \ X.XX$ \ X$ $XX.XX \ $X.XX \ $X
Snirki
  • 9
  • 1
-4
votes
1 answer

RegEx - Python: Error:TypeError: findall() missing 1 required positional argument: 'string'

I need to write an RegEx to search for invoice numbers (example: 513426 / 41811 / MIU ). but i always get the error: "Python: Error:TypeError: findall() missing 1 required positional argument: 'string' " Do you know what I did wrong I would…
-4
votes
2 answers

How to obtain multiple tuples using pythons findall

I'm trying to obtain multiple tuples from the following 'text' using python findall() text = '[szur formatter] line 1[szur parser] line 2' I want to get the following matching patterns from…
vibz
  • 157
  • 1
  • 12
-5
votes
1 answer

Regular expression findall python

I have text which look like that {"@context":"http://schema.org","@type":"Recipe","name":"Tartelette aux fraises et rhubarb'curd","recipeCategory":"tarte aux…
Gajiu
  • 91
  • 2
  • 9
-5
votes
1 answer

How to extract all the numbers from file and compute the sum of the numbers?

I will read through and parse a file with text and numbers. I will extract all the numbers in the file and compute the sum of the numbers. Data Files: http://python-data.dr-chuck.net/regex_sum_361580.txt My code is: import re sum = 0 file =…
-6
votes
1 answer

Regex not matching all the paranthesis substrings

'''txt = "But in any event, (not all) Christians believe in the same theology, such as the one Latter-day Saints believe in. (They will cry "heresy" and other accusations of "perverting" the doctrines of the Bible, while they themselves believe in…
1 2 3
56
57