Why am getting different syntax errors when running a Python script Programming Software Development by Tom_45 … run the program. Here is the problem code: matches = re.findall('<td>[0-9]+<\/td><td…, name, rank) names.append(item) #print(item)` On the re.findall statement, the error message invalid escape sequence on \d, so… Re: Extracting values from capturing groups in regex Programming Software Development by Reverend Jim …;right"><td>'): print(re.findall(pat,line)) I realized that findall is cleaner than split. You might want… Re: Why am getting different syntax errors when running a Python script Programming Software Development by Tom_45 After I posted this question I noticed that I was missing the raw string indicator and the capture group enclosing parenthesis on the findall, which explains the subscripting error. So, hold off on the answers for now. I'm still having other issues with multiple file runs, though. Converting PDF Image to CSV Using Multimodal Google Gemini Pro Programming Computer Science by usmanmalik57 …(r'\d+,\d+\s[€%]') temp_replacement = "TEMP_CURRENCY" currency_matches = special_patterns.findall(line) for match in currency_matches: line = line.replace(match, temp_replacement… Extracting values from capturing groups in regex Programming Software Development by Tom_45 …</td> I am using the pattern match = re.findall(r'<td.*?>([\d+])([.*?])*<\/td>', file) The… Extracting values from a regex match Programming Software Development by Tom_45 …</td> I am using the pattern match = re.findall(r'<td.?>([\d+])([.?])*<\/td>', file) The… PDF Image Table Extractor Web App with Google Gemini Pro and Streamlit Programming Computer Science by usmanmalik57 …(r'\d+,\d+\s[€%]') temp_replacement = "TEMP_CURRENCY" currency_matches = special_patterns.findall(line) for match in currency_matches: line = line.replace(match, temp_replacement… Re: Extracting values from capturing groups in regex Programming Software Development by AndreRet …;<td.*?>(.*?)<\/td>', re.DOTALL) matches = pattern.findall(html_data) for match in matches: print(f'({match[0]}, "… Re: Extracting values from a regex match Programming Software Development by Tom_45 Question has been answered. The correct pattern is: matches = re.findall(r'<td>(\d+)+<\/td><td>(\w+)<\/td><td>(\w+)', file) Re: Why am getting different syntax errors when running a Python script Programming Software Development by Tom_45 Finished the assignment and was able to work out the bugs I was encountering. In addition to the issues I mentioned in my last reply, I had several instances of not indenting properly so that statements like exit() were not executing because their indention made them part of an if statement. Re: Extracting values from capturing groups in regex Programming Software Development by Reverend Jim For html = '<tr align="right"><td>236</td><td>Roy</td><td>Allyson</td>' pat = '<td>(.+?)</td>' then re.split(pat,html) returns ['<tr align="right">', '236', '', 'Roy', '', 'Allyson', ''] and re.split(pat,html)[1::2] will … Re: Extracting values from a regex match Programming Software Development by Reverend Jim The trick is to use lazy matching which matches the shortest possible string. html = '<tr align="right"><td>236</td><td>Roy</td><td>Allyson</td>' pat = '<td>(.+?)</td>' then re.split(pat,html) returns ['<tr align="right">', '236', … Re: Extracting values from capturing groups in regex Programming Software Development by Tom_45 I'm not getting the results you presented, I'm getting the whole file not just the tr tags. The tr tags I used was just a subset of the entire file. Re: Extracting values from capturing groups in regex Programming Software Development by Reverend Jim Just process the file line by line and apply the regular expression to particular lines. I can't give you an expression that matches only the lines you showed me with a guarantee that in matches nothing else without seeing the entire file. Re: Extracting values from capturing groups in regex Programming Software Development by Reverend Jim You can either read the entire file into a list, then filter that list, or you could process it line by line and process each matching line. For example (using my file) for line in open('usblog.txt'): if '2024-01-24' in line: print(line) or text = open('usblog.txt').readlines() for line in [x for x in text if… Re: Extracting values from a regex match Programming Software Development by pritaeas Sidenote: If you want to learn, understand and experiment with regexes I can highly recommend RegexBuddy. Re: Extracting values from capturing groups in regex Programming Software Development by Tom_45 It's a long one, but here it is. <head><title>Popular Baby Names</title> <meta name="dc.language" scheme="ISO639-2" content="eng"> <meta name="dc.creator" content="OACT"> <meta name="lead_content_manager" content="JeffK"&… Re: Extracting values from a regex match Programming Software Development by Reverend Jim Also [autoregex](https://www.autoregex.xyz/) Re: Extracting values from a regex match Programming Software Development by AndreRet Same question, different post - [Extracting values from capturing groups in rege](https://www.daniweb.com/programming/software-development/threads/541420/extracting-values-from-capturing-groups-in-regex) Re: Extracting values from capturing groups in regex Programming Software Development by Tom_45 Issue resolved FindAll help Programming Software Development by scottlafoy …> InspectionKey = new List<Inspections>(); InspectionsType = myInspections.FindAll(delegate(Inspection insp) { return insp.Type == ProjectInspectionType.Basic; }); … I would like to do this with one findall. [CODE] InspectionsType = myInspections.FindAll(delegate(Inspection insp) { return insp.Type ==… Re: FindAll help Programming Software Development by apegram …Inspection("Enhanced","D"), }; var matches = inspections.FindAll(insp => insp.InspectionType == "Basic" &&… insp.InspectionKey == "A"); var matches2 = inspections.FindAll(delegate(Inspection insp) { return insp.InspectionType == "Basic" &… Re: findall Programming Software Development by pythopian …, you can use this: [CODE]>>> print re.findall(r'DHCP\s+.*?Internet Protocol,\s+Src:\s*(.+?)\s*\(.*?Bootstrap… IP's individually, use: [CODE]>>> print re.findall(r'DHCP Offer\s+.*?Internet Protocol,\s+Src:\s*(.+?)\s….S) ['192.168.110.33'] >>> print re.findall(r'DHCP Request\s+.*?Internet Protocol,\s+Src:\s*(.+?)\s… findall Programming Software Development by mitsuevo …;Internet Protocol) Src:" and "(" [code] temp = re.findall("DHCP\s+Offer(.)Bootstrap", text) print (temp) name…=re.findall("(Internet Protocol)\sSrc:.[(]", temp) print name [/code] but… Re: findall Programming Software Development by mitsuevo … = open(filename, "r") text = f.read() word = re.findall("(.*)Offer",text) splitter = re.compile('[\s]+') for n… Re: findall Programming Software Development by mitsuevo … (which I want) from all the packets. [code] datalines = re.findall("Protocol Info[\s]+(.*\s*.*)(.*\s*.*)(.*\s*.*)(.*\s*.*)(.*\s*.*)"… Re: findall Programming Software Development by mitsuevo [code] datalines = re.findall("Protocol Info(.*)[HTTP,TCP](.*)(.*\s*.*)(.*\s*.*)(.*\s*.*)(.*\s*.*)(.*\s*.*)&… Problem with re.findall() module (stops afther 4 times) Programming Software Development by sinnebril …run into a new problem, this time with the re.findall() module. The objective of this code is to iterate… Mus musculus Cyp2c66 Danio rerio Cyp2c38 * Without the re.findall() module all the rows are read, so is it …sh.nrows: row_cell = sh.cell(rowx,colx).value tuples = re.findall(r'(\w+\s\w+)\s*(CYP\w+)', row_cell) print 'TUPLES… Regular Expression Findall help Programming Software Development by rmbrown09 Just a quick question, why does the first findall print out hello but the second just gives me brackets with nothing in them. I want it to show me everything that matched. Which in this case should be everything. k = "hello there how are you" print re.findall(r'hello',k) print re.findall(r'\w+',k) Re: Problem with re.findall() module (stops afther 4 times) Programming Software Development by sinnebril Thanks! This is my new code and it works! tuples = re.findall(r'(\w+\s\w+)\s*(CYP\w+)', row_cell, re.IGNORECASE)