Extracting values from capturing groups in regex Programming Software Development by Tom_45 …') ('Collin', '', 'Collin') ('Raquel', '', 'Raquel') I'm relatively new to regular expressions so be gently, but any help would be appreciated. PS… Extracting values from a regex match Programming Software Development by Tom_45 …') ('Collin', '', 'Collin') ('Raquel', '', 'Raquel') I'm relatively new to regular expressions so be gently, but any help would be appreciated. PS… Re: Extracting values from capturing groups in regex Programming Software Development by AndreRet … using non-greedy quantifiers - [Minimal or non-greedy quantifiers](Regular expressions are generally considered greedy because an expression with repetitions will… The Rise of AI Scams: Deciphering Reality in a World of Deepfakes Community Center by Johannes C. … arsenal, allowing them to emulate a CEO's voice, facial expressions, mannerisms, and even their personality with frightening accuracy. Hence, my… Re: How do you use LLM AI tools in your daily programming workflow ? Community Center by rproffitt … for many things. Examples such a SQL queries and regular expressions. He tells me they saved mid 5 figures USD in… Re: Improve HAVING BY performance Programming Databases by Reverend Jim … to execute it efficiently. Avoid unnecessary joins, subqueries, or complex expressions in the HAVING clause that can slow down the query… 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 capturing groups in regex Programming Software Development by Reverend Jim Try import re pat = '<td>(.+?)</td>' for line in open('yourfile.html'): if line.startswith('<tr align="right"><td>'): print(re.findall(pat,line)) I realized that findall is cleaner than split. You might want to have a look at [this regex online tool](https://www… 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 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: Operarors in C? Programming Software Development by Aia Expressions has direct effects and side effects. This expression, `x = y;` … Re: Copy constructor in derived class Programming Software Development by barfoo Expressions like [code]Base( &theObject );[/code] don't behave the … Calculating Math Expressions (Please Help!) Programming Software Development by DontQueef …hasMoreTokens() != true){ return null; }else{ String temp = ""; String expressions = "+-*/"; temp = toks.nextToken(); if(temp.length() == 1 &…amp;& expressions.indexOf(temp) >= 0){ switch((char)temp){ case '-' : new … Parenthesize following expressions Programming Software Development by JoBe …got an exercise in which I have to fully parenthesize expressions using the higher-lower precedence, for instance: a+b… precedence then addition. Here are my solutions for the following expressions: 1) a = b + c * d << 2 &… Don't think there is a solution either since the expressions are not correct? 8) a = b == c ++ (a = (b ==… Generating Random Expressions Programming Software Development by Gen.Asura Hey, I posted earlier about arbitrary expressions and I did find solution to that. The question is …how do I create random expressions? So far I've created codes to generate random operators… and random numbers, how will I generate random expressions? E.g. a1,a2,a3 are variables for random numbers… Re: Calculating Math Expressions (Please Help!) Programming Software Development by DontQueef … the numbers. The example above is extra confusing because 2 expressions comes before the numbers. So my question is: What do… Prefix Expressions Programming Software Development by HankReardon … this by using a stack to store values of sub-expressions as they are computed, and another stack to store operators… solved yet? So I will have 1 stack of sub expressions before each is solved. Once the stack is made I… the same stack. I will do this to all sub expressions inside the stack. Once this is done I will begin… Re: Parenthesize following expressions Programming Software Development by Ravalon … Don't think there is a solution either since the expressions are not correct?[/QUOTE] That's a cruel example. It… Re: Parenthesize following expressions Programming Software Development by JoBe Hello ladies and gents, Ive got a few more expressions I needed to fully parenthesize: 1) *p++ becomes *(p++) 2) *--… Re: Parenthesize following expressions Programming Software Development by Dave Sinkula …;304191]Hello ladies and gents, Ive got a few more expressions I needed to fully parenthesize: 1) *p++ becomes *(p++) 2… Re: Parenthesize following expressions Programming Software Development by JoBe … practise your knowledge of order of precedence for the various expressions. @ Walt, thanks for that Walt, but, as said previous, don… Re: Parenthesize following expressions Programming Software Development by Dave Sinkula … to avoid ambiguity", I generally prefer to use simpler expressions. If I have to think about an expression for a…